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/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_1234 | 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_1234: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_1234: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_1234: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_1234: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_1234: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_1234:Expr_L50_C2", "label": "expression", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L49_C0", "vector": [8, 1, 0.5208, 0.0104, 1, 0.52, 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_1234:Assign_L51_C2", "label": "f = open()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L49_C0", "vector": [14, 1, 0.5312, 0.0104, 1, 0.52, 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_1234:Assign_L52_C2", "label": "text = read()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L49_C0", "vector": [14, 1, 0.5417, 0.0104, 1, 0.52, 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_1234:Assign_L53_C2", "label": "text = sub()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L49_C0", "vector": [14, 1, 0.5521, 0.0104, 1, 0.52, 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_1234:Assign_L54_C2", "label": "lines = split()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L49_C0", "vector": [14, 1, 0.5625, 0.0104, 1, 0.52, 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_1234:If_L55_C2", "label": "if", "type": "if", "loc": [55, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L49_C0", "vector": [4, 1, 0.5781, 0.0208, 1, 0.52, 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_1234:Return_L56_C4", "label": "return", "type": "return", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L55_C2", "vector": [13, 2, 0.5833, 0.0104, 2, 0.6, 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_1234:Assign_L57_C2", "label": "mimic =", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L49_C0", "vector": [14, 1, 0.5938, 0.0104, 1, 0.52, 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_1234:Assign_L58_C2", "label": "suf =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L49_C0", "vector": [14, 1, 0.6042, 0.0104, 1, 0.52, 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_1234:For_L59_C2", "label": "for i", "type": "for", "loc": [59, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L49_C0", "vector": [6, 1, 0.651, 0.0833, 1, 0.52, 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_1234:If_L60_C4", "label": "if", "type": "if", "loc": [60, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:For_L59_C2", "vector": [4, 2, 0.6562, 0.0729, 2, 0.36, 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_1234:Assign_L61_C6", "label": "j =", "type": "assigned_variable", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L60_C4", "vector": [14, 3, 0.6354, 0.0104, 3, 0.74, 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_1234:For_L62_C6", "label": "for j", "type": "for", "loc": [62, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L60_C4", "vector": [6, 3, 0.6562, 0.0312, 3, 0.74, 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_1234:If_L63_C8", "label": "if", "type": "if", "loc": [63, 64], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:For_L62_C6", "vector": [4, 4, 0.6615, 0.0208, 4, 0.64, 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_1234:Expr_L64_C10", "label": "append()", "type": "expression", "loc": [64, 64], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L63_C8", "vector": [8, 5, 0.6667, 0.0104, 5, 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": " suf.append(lines[j+1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1234:Expr_L65_C6", "label": "update()", "type": "expression", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L60_C4", "vector": [8, 3, 0.6771, 0.0104, 3, 0.74, 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_1234:Assign_L66_C6", "label": "suf =", "type": "assigned_variable", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L60_C4", "vector": [14, 3, 0.6875, 0.0104, 3, 0.74, 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_1234:Return_L67_C2", "label": "return", "type": "return", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L49_C0", "vector": [13, 1, 0.6979, 0.0104, 1, 0.52, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return mimic"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1234: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_1234:Expr_L71_C2", "label": "expression", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L70_C0", "vector": [8, 1, 0.7396, 0.0104, 1, 0.01, 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_1234:If_L72_C2", "label": "if", "type": "if", "loc": [72, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L70_C0", "vector": [4, 1, 0.7604, 0.0312, 1, 0.01, 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_1234:Expr_L73_C4", "label": "print()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L72_C2", "vector": [8, 2, 0.7604, 0.0104, 2, 0.63, 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_1234:Return_L74_C4", "label": "return", "type": "return", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L72_C2", "vector": [13, 2, 0.7708, 0.0104, 2, 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_1234:For_L75_C2", "label": "for i", "type": "for", "loc": [75, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L70_C0", "vector": [6, 1, 0.8125, 0.0729, 1, 0.01, 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_1234:If_L76_C4", "label": "if", "type": "if", "loc": [76, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:For_L75_C2", "vector": [4, 2, 0.8177, 0.0625, 2, 0.19, 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_1234:Assign_L77_C6", "label": "word = get()", "type": "assigned_variable", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L76_C4", "vector": [14, 3, 0.8021, 0.0104, 3, 0.29, 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_1234:Expr_L78_C6", "label": "write()", "type": "expression", "loc": [78, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L76_C4", "vector": [8, 3, 0.8125, 0.0104, 3, 0.29, 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_1234:Assign_L80_C6", "label": "word = choice()", "type": "assigned_variable", "loc": [80, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L76_C4", "vector": [14, 3, 0.8333, 0.0104, 3, 0.29, 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_1234:Expr_L81_C6", "label": "write()", "type": "expression", "loc": [81, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L76_C4", "vector": [8, 3, 0.8438, 0.0104, 3, 0.29, 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_1234:Return_L82_C2", "label": "return", "type": "return", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L70_C0", "vector": [13, 1, 0.8542, 0.0104, 1, 0.01, 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_1234: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_1234:If_L87_C2", "label": "if", "type": "if", "loc": [87, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L86_C0", "vector": [4, 1, 0.9167, 0.0312, 1, 0.67, 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_1234:Expr_L88_C4", "label": "print()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L87_C2", "vector": [8, 2, 0.9167, 0.0104, 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: ./mimic.py file-to-read')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1234:Expr_L89_C4", "label": "exit()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L87_C2", "vector": [8, 2, 0.9271, 0.0104, 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_1234:Assign_L91_C2", "label": "dict = mimic_dict()", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L86_C0", "vector": [14, 1, 0.9479, 0.0104, 1, 0.67, 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_1234:Expr_L92_C2", "label": "print_mimic()", "type": "expression", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L86_C0", "vector": [8, 1, 0.9583, 0.0104, 1, 0.67, 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_1234: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_1234:Expr_L96_C2", "label": "main()", "type": "expression", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L95_C0", "vector": [8, 1, 1.0, 0.0104, 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_1234:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Expr_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Assign_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Assign_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Assign_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Return_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Assign_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Assign_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:For_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:For_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Assign_L61_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:For_L62_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:For_L62_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L63_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Expr_L64_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Expr_L65_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Assign_L66_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Return_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Expr_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L72_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L72_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Return_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:For_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:For_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L76_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Assign_L77_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L76_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Expr_L78_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L76_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Assign_L80_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L76_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Expr_L81_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Return_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Expr_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Expr_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Assign_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:FunctionDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1234:Expr_L92_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1234:If_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1234: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_1236 | 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_1236: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_1236:Assign_L16_C2", "label": "i =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L15_C0", "vector": [14, 1, 0.2388, 0.0149, 1, 0.87, 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_1236:Assign_L17_C2", "label": "newlist =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L15_C0", "vector": [14, 1, 0.2537, 0.0149, 1, 0.87, 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_1236:For_L18_C2", "label": "for i", "type": "for", "loc": [18, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L15_C0", "vector": [6, 1, 0.2836, 0.0448, 1, 0.87, 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_1236:If_L19_C4", "label": "if", "type": "if", "loc": [19, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:For_L18_C2", "vector": [4, 2, 0.291, 0.0299, 2, 0.04, 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_1236:Expr_L20_C6", "label": "append()", "type": "expression", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:If_L19_C4", "vector": [8, 3, 0.2985, 0.0149, 3, 0.79, 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_1236:Return_L21_C2", "label": "return", "type": "return", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L15_C0", "vector": [13, 1, 0.3134, 0.0149, 1, 0.87, 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_1236: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_1236:Expr_L29_C2", "label": "extend()", "type": "expression", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L28_C0", "vector": [8, 1, 0.4328, 0.0149, 1, 0.24, 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_1236:Return_L30_C2", "label": "return", "type": "return", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L28_C0", "vector": [13, 1, 0.4478, 0.0149, 1, 0.24, 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_1236: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_1236:If_L44_C2", "label": "if", "type": "if", "loc": [44, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L43_C0", "vector": [4, 1, 0.6791, 0.0597, 1, 0.74, 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_1236:Assign_L45_C4", "label": "prefix =", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:If_L44_C2", "vector": [14, 2, 0.6716, 0.0149, 2, 0.74, 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_1236:Assign_L47_C4", "label": "prefix =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:If_L44_C2", "vector": [14, 2, 0.7015, 0.0149, 2, 0.74, 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_1236:Expr_L48_C2", "label": "print()", "type": "expression", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L43_C0", "vector": [8, 1, 0.7164, 0.0149, 1, 0.74, 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_1236: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_1236:Expr_L53_C2", "label": "print()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L52_C0", "vector": [8, 1, 0.791, 0.0149, 1, 0.7, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('remove_adjacent')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1236:Expr_L54_C2", "label": "test()", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L52_C0", "vector": [8, 1, 0.806, 0.0149, 1, 0.7, 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_1236:Expr_L55_C2", "label": "test()", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L52_C0", "vector": [8, 1, 0.8209, 0.0149, 1, 0.7, 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_1236:Expr_L56_C2", "label": "test()", "type": "expression", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L52_C0", "vector": [8, 1, 0.8358, 0.0149, 1, 0.7, 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_1236:Expr_L58_C2", "label": "test()", "type": "expression", "loc": [58, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L52_C0", "vector": [8, 1, 0.8731, 0.0299, 1, 0.7, 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_1236:Expr_L60_C2", "label": "test()", "type": "expression", "loc": [60, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L52_C0", "vector": [8, 1, 0.903, 0.0299, 1, 0.7, 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_1236:Expr_L62_C2", "label": "test()", "type": "expression", "loc": [62, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L52_C0", "vector": [8, 1, 0.9328, 0.0299, 1, 0.7, 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_1236: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_1236:Expr_L67_C2", "label": "main()", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1236:If_L66_C0", "vector": [8, 1, 1.0, 0.0149, 1, 0.37, 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_1236:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1236:Assign_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1236:Assign_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1236:For_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1236:For_L18_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1236:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1236:If_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1236:Expr_L20_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1236:Return_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1236:Expr_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1236:Return_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1236:If_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1236:If_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1236:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1236:If_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1236:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1236:Expr_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1236:Expr_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1236:Expr_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1236:Expr_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1236:Expr_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1236:Expr_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1236:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1236:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1236:Expr_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1236:If_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1236: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_1237 | 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_1237: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_1237: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_1237: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_1237: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_1237:Assign_L44_C2", "label": "f = open()", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L43_C0", "vector": [14, 1, 0.4536, 0.0103, 1, 0.24, 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_1237:Assign_L45_C2", "label": "text = read()", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L43_C0", "vector": [14, 1, 0.4639, 0.0103, 1, 0.24, 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_1237:Assign_L46_C2", "label": "text = sub()", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L43_C0", "vector": [14, 1, 0.4742, 0.0103, 1, 0.24, 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_1237:Assign_L47_C2", "label": "lines = sorted()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L43_C0", "vector": [14, 1, 0.4845, 0.0103, 1, 0.24, 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_1237:Assign_L48_C2", "label": "newlines =", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L43_C0", "vector": [14, 1, 0.4948, 0.0103, 1, 0.24, 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_1237:Assign_L49_C2", "label": "i =", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L43_C0", "vector": [14, 1, 0.5052, 0.0103, 1, 0.24, 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_1237:For_L50_C2", "label": "for i", "type": "for", "loc": [50, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L43_C0", "vector": [6, 1, 0.5309, 0.0412, 1, 0.24, 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_1237:If_L51_C4", "label": "if", "type": "if", "loc": [51, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:For_L50_C2", "vector": [4, 2, 0.5361, 0.0309, 2, 0.79, 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_1237:Expr_L52_C6", "label": "append()", "type": "expression", "loc": [52, 52], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L51_C4", "vector": [8, 3, 0.5361, 0.0103, 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": " newlines.append(lines[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1237:Expr_L53_C6", "label": "append()", "type": "expression", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L51_C4", "vector": [8, 3, 0.5464, 0.0103, 3, 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": " newlines.append(lines.count(lines[i]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1237:Assign_L54_C2", "label": "arr =", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L43_C0", "vector": [14, 1, 0.5567, 0.0103, 1, 0.24, 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_1237:For_L55_C2", "label": "for i", "type": "for", "loc": [55, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L43_C0", "vector": [6, 1, 0.5722, 0.0206, 1, 0.24, 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_1237:Expr_L56_C4", "label": "append()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:For_L55_C2", "vector": [8, 2, 0.5773, 0.0103, 2, 0.09, 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_1237:Return_L57_C2", "label": "return", "type": "return", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L43_C0", "vector": [13, 1, 0.5876, 0.0103, 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 arr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1237: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_1237:Assign_L60_C2", "label": "arr = readfile()", "type": "assigned_variable", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L59_C0", "vector": [14, 1, 0.6186, 0.0103, 1, 0.33, 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_1237:For_L61_C2", "label": "for i", "type": "for", "loc": [61, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L59_C0", "vector": [6, 1, 0.634, 0.0206, 1, 0.33, 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_1237:Expr_L62_C4", "label": "print()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:For_L61_C2", "vector": [8, 2, 0.6392, 0.0103, 2, 0.45, 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_1237:Return_L63_C2", "label": "return", "type": "return", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L59_C0", "vector": [13, 1, 0.6495, 0.0103, 1, 0.33, 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_1237: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_1237:Assign_L66_C2", "label": "arr = readfile()", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L65_C0", "vector": [14, 1, 0.6804, 0.0103, 1, 0.7, 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_1237:Assign_L67_C2", "label": "newarr = sorted()", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L65_C0", "vector": [14, 1, 0.6907, 0.0103, 1, 0.7, 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_1237:For_L68_C2", "label": "for i", "type": "for", "loc": [68, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L65_C0", "vector": [6, 1, 0.7062, 0.0206, 1, 0.7, 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_1237:Expr_L69_C4", "label": "print()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:For_L68_C2", "vector": [8, 2, 0.7113, 0.0103, 2, 0.33, 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_1237:Return_L70_C2", "label": "return", "type": "return", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L65_C0", "vector": [13, 1, 0.7216, 0.0103, 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_1237: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_1237:If_L82_C2", "label": "if", "type": "if", "loc": [82, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L81_C0", "vector": [4, 1, 0.8557, 0.0309, 1, 0.75, 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_1237:Expr_L83_C4", "label": "print()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L82_C2", "vector": [8, 2, 0.8557, 0.0103, 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('usage: ./wordcount.py {--count | --topcount} file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1237:Expr_L84_C4", "label": "exit()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L82_C2", "vector": [8, 2, 0.866, 0.0103, 2, 0.93, 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_1237:Assign_L86_C2", "label": "option =", "type": "assigned_variable", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L81_C0", "vector": [14, 1, 0.8866, 0.0103, 1, 0.75, 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_1237:Assign_L87_C2", "label": "filename =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L81_C0", "vector": [14, 1, 0.8969, 0.0103, 1, 0.75, 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_1237:If_L88_C2", "label": "if", "type": "if", "loc": [88, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L81_C0", "vector": [4, 1, 0.9381, 0.0722, 1, 0.75, 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_1237:Expr_L89_C4", "label": "print_words()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L88_C2", "vector": [8, 2, 0.9175, 0.0103, 2, 0.38, 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_1237:If_L90_C2", "label": "if", "type": "if", "loc": [90, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L88_C2", "vector": [4, 2, 0.9485, 0.0515, 2, 0.38, 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_1237:Expr_L91_C4", "label": "print_top()", "type": "expression", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L90_C2", "vector": [8, 3, 0.9381, 0.0103, 3, 0.01, 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_1237:Expr_L93_C4", "label": "print()", "type": "expression", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L90_C2", "vector": [8, 3, 0.9588, 0.0103, 3, 0.01, 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_1237:Expr_L94_C4", "label": "exit()", "type": "expression", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L90_C2", "vector": [8, 3, 0.9691, 0.0103, 3, 0.01, 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_1237: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_1237:Expr_L97_C2", "label": "main()", "type": "expression", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L96_C0", "vector": [8, 1, 1.0, 0.0103, 1, 0.37, 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_1237:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Assign_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Assign_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Assign_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Assign_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Assign_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Assign_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:For_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:For_L50_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Expr_L52_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Expr_L53_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Assign_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:For_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:For_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Return_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Assign_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:For_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:For_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Return_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Assign_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Assign_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:For_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:For_L68_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Return_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Expr_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Assign_L86_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Expr_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Expr_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1237:If_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1237:Expr_L97_C2"}] |
#!/usr/bin/python
# 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/
import sys
import re
"""Baby Names exercise
Define the extract_names() function below and change main()
to call it.
For writing regex, it's nice to include a copy of the target
text for inspiration.
Here's what the html looks like in the baby.html files:
...
<h3 align="center">Popularity in 1990</h3>
....
<tr align="right"><td>1</td><td>Michael</td><td>Jessica</td>
<tr align="right"><td>2</td><td>Christopher</td><td>Ashley</td>
<tr align="right"><td>3</td><td>Matthew</td><td>Brittany</td>
...
Suggested milestones for incremental development:
-Extract the year and print it
-Extract the names and rank numbers and just print them
-Get the names data into a dict and print it
-Build the [year, 'name rank', ... ] list and print it
-Fix main() to use the extract_names list
"""
def extract_names(filename):
"""
Given a file name for baby.html, returns a list starting with the year string
followed by the name-rank strings in alphabetical order.
['2006', 'Aaliyah 91', Aaron 57', 'Abagail 895', ' ...]
"""
# +++your code here+++
return
def main():
# This command-line parsing code is provided.
# Make a list of command line arguments, omitting the [0] element
# which is the script itself.
args = sys.argv[1:]
if not args:
print 'usage: [--summaryfile] file [file ...]'
sys.exit(1)
# Notice the summary flag and remove it from args if it is present.
summary = False
if args[0] == '--summaryfile':
summary = True
del args[0]
# +++your code here+++
# For each filename, get the names, then either print the text output
# or write it to a summary file
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1239 | 16 | 68 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1239:Import_L9_C0", "label": "sys import sys", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1324, 0.0147, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1239:Import_L10_C0", "label": "re import re", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1471, 0.0147, 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_1239:Expr_L12_C0", "label": "expression", "type": "expression", "loc": [12, 35], "level": 0, "parent": null, "vector": [8, 0, 0.3456, 0.3529, 0, 0.66, 0.4, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Baby Names exercise\n\nDefine the extract_names() function below and change main()\nto call it.\n\nFor writing regex, it's nice to include a copy of the target\ntext for inspiration.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1239:FunctionDef_L37_C0", "label": "extract_names", "type": "function", "loc": [37, 44], "level": 0, "parent": null, "vector": [2, 0, 0.5956, 0.1176, 0, 0.66, 0.6, 851, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "extract_names", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def extract_names(filename):\n \"\"\"\n Given a file name for baby.html, returns a list starting with the year string\n followed by the name-rank strings in alphabetical order.\n ['2006', 'Aaliyah 91', Aaron 57', 'Abagail 895', ' ...]\n \"\"\"\n # +++your code here+++\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1239:Expr_L38_C2", "label": "expression", "type": "expression", "loc": [38, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1239:FunctionDef_L37_C0", "vector": [8, 1, 0.5882, 0.0735, 1, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Given a file name for baby.html, returns a list starting with the year string\n followed by the name-rank strings in alphabetical order.\n ['2006', 'Aaliyah 91', Aaron 57', 'Abagail 895', ' ...]\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1239:Return_L44_C2", "label": "return", "type": "return", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1239:FunctionDef_L37_C0", "vector": [13, 1, 0.6471, 0.0147, 1, 0.27, 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_1239:FunctionDef_L47_C0", "label": "main", "type": "function", "loc": [47, 61], "level": 0, "parent": null, "vector": [2, 0, 0.7941, 0.2206, 0, 0.66, 0.8, 624, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n # This command-line parsing code is provided.\n # Make a list of command line arguments, omitting the [0] element\n # which is the script itself.\n args = sys.argv[1:]\n\n if not args:\n print('usage: [--summaryfile] file [file ...]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1239:Assign_L51_C2", "label": "args =", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1239:FunctionDef_L47_C0", "vector": [14, 1, 0.75, 0.0147, 1, 0.9, 0.0, 805, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = sys.argv[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1239:If_L53_C2", "label": "if", "type": "if", "loc": [53, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1239:FunctionDef_L47_C0", "vector": [4, 1, 0.7941, 0.0441, 1, 0.9, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not args:\n print('usage: [--summaryfile] file [file ...]')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1239:Expr_L54_C4", "label": "print()", "type": "expression", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1239:If_L53_C2", "vector": [8, 2, 0.7941, 0.0147, 2, 0.49, 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: [--summaryfile] file [file ...]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1239:Expr_L55_C4", "label": "exit()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1239:If_L53_C2", "vector": [8, 2, 0.8088, 0.0147, 2, 0.49, 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_1239:Assign_L58_C2", "label": "summary =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1239:FunctionDef_L47_C0", "vector": [14, 1, 0.8529, 0.0147, 1, 0.9, 0.6667, 977, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "summary", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " summary = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1239:If_L59_C2", "label": "if", "type": "if", "loc": [59, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1239:FunctionDef_L47_C0", "vector": [4, 1, 0.8824, 0.0441, 1, 0.9, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args[0] == '--summaryfile':\n summary = True\n del args[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1239:Assign_L60_C4", "label": "summary =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1239:If_L59_C2", "vector": [14, 2, 0.8824, 0.0147, 2, 0.39, 0.0, 977, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "summary", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " summary = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1239:If_L67_C0", "label": "if", "type": "if", "loc": [67, 68], "level": 0, "parent": null, "vector": [4, 0, 0.9926, 0.0294, 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_1239:Expr_L68_C2", "label": "main()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1239:If_L67_C0", "vector": [8, 1, 1.0, 0.0147, 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": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1239:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1239:Expr_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1239:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1239:Return_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1239:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1239:Assign_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1239:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1239:If_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1239:If_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1239:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1239:If_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1239:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1239:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1239:Assign_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1239:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1239:If_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1239:If_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1239:Assign_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1239:If_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1239:Expr_L68_C2"}] |
#!/usr/bin/python
# 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/
import sys
import re
"""Baby Names exercise
Define the extract_names() function below and change main()
to call it.
For writing regex, it's nice to include a copy of the target
text for inspiration.
Here's what the html looks like in the baby.html files:
...
<h3 align="center">Popularity in 1990</h3>
....
<tr align="right"><td>1</td><td>Michael</td><td>Jessica</td>
<tr align="right"><td>2</td><td>Christopher</td><td>Ashley</td>
<tr align="right"><td>3</td><td>Matthew</td><td>Brittany</td>
...
Suggested milestones for incremental development:
-Extract the year and print it
-Extract the names and rank numbers and just print them
-Get the names data into a dict and print it
-Build the [year, 'name rank', ... ] list and print it
-Fix main() to use the extract_names list
"""
def extract_names(filename):
"""
Given a file name for baby.html, returns a list starting with the year string
followed by the name-rank strings in alphabetical order.
['2006', 'Aaliyah 91', Aaron 57', 'Abagail 895', ' ...]
"""
# +++your code here+++
return
def main():
# This command-line parsing code is provided.
# Make a list of command line arguments, omitting the [0] element
# which is the script itself.
args = sys.argv[1:]
if not args:
print 'usage: [--summaryfile] file [file ...]'
sys.exit(1)
# Notice the summary flag and remove it from args if it is present.
summary = False
if args[0] == '--summaryfile':
summary = True
del args[0]
# +++your code here+++
# For each filename, get the names, then either print the text output
# or write it to a summary file
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1240 | 16 | 68 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1240:Import_L9_C0", "label": "sys import sys", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1324, 0.0147, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1240:Import_L10_C0", "label": "re import re", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1471, 0.0147, 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_1240:Expr_L12_C0", "label": "expression", "type": "expression", "loc": [12, 35], "level": 0, "parent": null, "vector": [8, 0, 0.3456, 0.3529, 0, 0.66, 0.4, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Baby Names exercise\n\nDefine the extract_names() function below and change main()\nto call it.\n\nFor writing regex, it's nice to include a copy of the target\ntext for inspiration.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1240:FunctionDef_L37_C0", "label": "extract_names", "type": "function", "loc": [37, 44], "level": 0, "parent": null, "vector": [2, 0, 0.5956, 0.1176, 0, 0.66, 0.6, 851, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "extract_names", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def extract_names(filename):\n \"\"\"\n Given a file name for baby.html, returns a list starting with the year string\n followed by the name-rank strings in alphabetical order.\n ['2006', 'Aaliyah 91', Aaron 57', 'Abagail 895', ' ...]\n \"\"\"\n # +++your code here+++\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1240:Expr_L38_C2", "label": "expression", "type": "expression", "loc": [38, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1240:FunctionDef_L37_C0", "vector": [8, 1, 0.5882, 0.0735, 1, 0.01, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Given a file name for baby.html, returns a list starting with the year string\n followed by the name-rank strings in alphabetical order.\n ['2006', 'Aaliyah 91', Aaron 57', 'Abagail 895', ' ...]\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1240:Return_L44_C2", "label": "return", "type": "return", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1240:FunctionDef_L37_C0", "vector": [13, 1, 0.6471, 0.0147, 1, 0.01, 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_1240:FunctionDef_L47_C0", "label": "main", "type": "function", "loc": [47, 61], "level": 0, "parent": null, "vector": [2, 0, 0.7941, 0.2206, 0, 0.66, 0.8, 624, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n # This command-line parsing code is provided.\n # Make a list of command line arguments, omitting the [0] element\n # which is the script itself.\n args = sys.argv[1:]\n\n if not args:\n print('usage: [--summaryfile] file [file ...]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1240:Assign_L51_C2", "label": "args =", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1240:FunctionDef_L47_C0", "vector": [14, 1, 0.75, 0.0147, 1, 0.89, 0.0, 805, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = sys.argv[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1240:If_L53_C2", "label": "if", "type": "if", "loc": [53, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1240:FunctionDef_L47_C0", "vector": [4, 1, 0.7941, 0.0441, 1, 0.89, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not args:\n print('usage: [--summaryfile] file [file ...]')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1240:Expr_L54_C4", "label": "print()", "type": "expression", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1240:If_L53_C2", "vector": [8, 2, 0.7941, 0.0147, 2, 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('usage: [--summaryfile] file [file ...]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1240:Expr_L55_C4", "label": "exit()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1240:If_L53_C2", "vector": [8, 2, 0.8088, 0.0147, 2, 0.37, 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_1240:Assign_L58_C2", "label": "summary =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1240:FunctionDef_L47_C0", "vector": [14, 1, 0.8529, 0.0147, 1, 0.89, 0.6667, 977, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "summary", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " summary = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1240:If_L59_C2", "label": "if", "type": "if", "loc": [59, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1240:FunctionDef_L47_C0", "vector": [4, 1, 0.8824, 0.0441, 1, 0.89, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args[0] == '--summaryfile':\n summary = True\n del args[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1240:Assign_L60_C4", "label": "summary =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1240:If_L59_C2", "vector": [14, 2, 0.8824, 0.0147, 2, 0.69, 0.0, 977, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "summary", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " summary = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1240:If_L67_C0", "label": "if", "type": "if", "loc": [67, 68], "level": 0, "parent": null, "vector": [4, 0, 0.9926, 0.0294, 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_1240:Expr_L68_C2", "label": "main()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1240:If_L67_C0", "vector": [8, 1, 1.0, 0.0147, 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_1240:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1240:Expr_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1240:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1240:Return_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1240:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1240:Assign_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1240:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1240:If_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1240:If_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1240:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1240:If_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1240:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1240:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1240:Assign_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1240:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1240:If_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1240:If_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1240:Assign_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1240:If_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1240:Expr_L68_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/
"""A tiny Python program to check that Python is working.
Try running this program from the command line like this:
python hello.py
python hello.py Alice
That should print:
Hello World -or- Hello Alice
Try changing the 'Hello' to 'Howdy' and run again.
Once you have that working, you're ready for class -- you can edit
and run Python code; now you just need to learn Python!
"""
import sys
# Define a main() function that prints a little greeting.
def main():
# Get the name from the command line, using 'World' as a fallback.
if len(sys.argv) >= 2:
name = sys.argv[1]
else:
name = 'World'
print 'Hello', name
# This is the standard boilerplate that calls the main() function.
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1241 | 9 | 33 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1241:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 18], "level": 0, "parent": null, "vector": [8, 0, 0.4091, 0.303, 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 tiny Python program to check that Python is working.\nTry running this program from the command line like this:\n python hello.py\n python hello.py Alice\nThat should print:\n Hello World -or- Hello Alice\nTry changing the 'Hello' to 'Howdy' and run again.\nOnce you have that working, you're ready for class -- you can edit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1241:Import_L20_C0", "label": "sys import sys", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.6061, 0.0303, 0, 0.66, 0.3333, 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_1241:FunctionDef_L23_C0", "label": "main", "type": "function", "loc": [23, 29], "level": 0, "parent": null, "vector": [2, 0, 0.7879, 0.2121, 0, 0.66, 0.6667, 624, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n # Get the name from the command line, using 'World' as a fallback.\n if len(sys.argv) >= 2:\n name = sys.argv[1]\n else:\n name = 'World'\n print('Hello', name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1241:If_L25_C2", "label": "if", "type": "if", "loc": [25, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1241:FunctionDef_L23_C0", "vector": [4, 1, 0.803, 0.1212, 1, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) >= 2:\n name = sys.argv[1]\n else:\n name = 'World'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1241:Assign_L26_C4", "label": "name =", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1241:If_L25_C2", "vector": [14, 2, 0.7879, 0.0303, 2, 0.94, 0.0, 57, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1241:Assign_L28_C4", "label": "name =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1241:If_L25_C2", "vector": [14, 2, 0.8485, 0.0303, 2, 0.94, 1.0, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = 'World'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1241:Expr_L29_C2", "label": "print()", "type": "expression", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1241:FunctionDef_L23_C0", "vector": [8, 1, 0.8788, 0.0303, 1, 0.6, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Hello', name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1241:If_L32_C0", "label": "if", "type": "if", "loc": [32, 33], "level": 0, "parent": null, "vector": [4, 0, 0.9848, 0.0606, 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_1241:Expr_L33_C2", "label": "main()", "type": "expression", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1241:If_L32_C0", "vector": [8, 1, 1.0, 0.0303, 1, 0.98, 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_1241:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1241:If_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1241:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1241:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1241:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1241:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1241:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1241:Expr_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1241:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1241:Expr_L33_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/
"""A tiny Python program to check that Python is working.
Try running this program from the command line like this:
python hello.py
python hello.py Alice
That should print:
Hello World -or- Hello Alice
Try changing the 'Hello' to 'Howdy' and run again.
Once you have that working, you're ready for class -- you can edit
and run Python code; now you just need to learn Python!
"""
import sys
# Define a main() function that prints a little greeting.
def main():
# Get the name from the command line, using 'World' as a fallback.
if len(sys.argv) >= 2:
name = sys.argv[1]
else:
name = 'World'
print 'Hello', name
# This is the standard boilerplate that calls the main() function.
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1242 | 9 | 33 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1242:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 18], "level": 0, "parent": null, "vector": [8, 0, 0.4091, 0.303, 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 tiny Python program to check that Python is working.\nTry running this program from the command line like this:\n python hello.py\n python hello.py Alice\nThat should print:\n Hello World -or- Hello Alice\nTry changing the 'Hello' to 'Howdy' and run again.\nOnce you have that working, you're ready for class -- you can edit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1242:Import_L20_C0", "label": "sys import sys", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.6061, 0.0303, 0, 0.66, 0.3333, 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_1242:FunctionDef_L23_C0", "label": "main", "type": "function", "loc": [23, 29], "level": 0, "parent": null, "vector": [2, 0, 0.7879, 0.2121, 0, 0.66, 0.6667, 624, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n # Get the name from the command line, using 'World' as a fallback.\n if len(sys.argv) >= 2:\n name = sys.argv[1]\n else:\n name = 'World'\n print('Hello', name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1242:If_L25_C2", "label": "if", "type": "if", "loc": [25, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1242:FunctionDef_L23_C0", "vector": [4, 1, 0.803, 0.1212, 1, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) >= 2:\n name = sys.argv[1]\n else:\n name = 'World'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1242:Assign_L26_C4", "label": "name =", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1242:If_L25_C2", "vector": [14, 2, 0.7879, 0.0303, 2, 0.79, 0.0, 57, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1242:Assign_L28_C4", "label": "name =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1242:If_L25_C2", "vector": [14, 2, 0.8485, 0.0303, 2, 0.79, 1.0, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = 'World'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1242:Expr_L29_C2", "label": "print()", "type": "expression", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1242:FunctionDef_L23_C0", "vector": [8, 1, 0.8788, 0.0303, 1, 0.56, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Hello', name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1242:If_L32_C0", "label": "if", "type": "if", "loc": [32, 33], "level": 0, "parent": null, "vector": [4, 0, 0.9848, 0.0606, 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_1242:Expr_L33_C2", "label": "main()", "type": "expression", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1242:If_L32_C0", "vector": [8, 1, 1.0, 0.0303, 1, 0.02, 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_1242:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1242:If_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1242:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1242:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1242:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1242:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1242:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1242:Expr_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1242:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1242:Expr_L33_C2"}] |
#!/usr/bin/python
# 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/
import sys
import re
import os
import shutil
import commands
"""Copy Special exercise
"""
# +++your code here+++
# Write functions and modify main() to call them
def main():
# This basic command line argument parsing code is provided.
# Add code to call your functions below.
# Make a list of command line arguments, omitting the [0] element
# which is the script itself.
args = sys.argv[1:]
if not args:
print "usage: [--todir dir][--tozip zipfile] dir [dir ...]";
sys.exit(1)
# todir and tozip are either set from command line
# or left as the empty string.
# The args array is left just containing the dirs.
todir = ''
if args[0] == '--todir':
todir = args[1]
del args[0:2]
tozip = ''
if args[0] == '--tozip':
tozip = args[1]
del args[0:2]
if len(args) == 0:
print "error: must specify one or more dirs"
sys.exit(1)
# +++your code here+++
# Call your functions
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_1243 | 21 | 54 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1243:Import_L9_C0", "label": "sys import sys", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0185, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1243:Import_L10_C0", "label": "re import re", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1852, 0.0185, 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_1243:Import_L11_C0", "label": "os import os", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.2037, 0.0185, 0, 0.66, 0.2857, 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_1243:Import_L12_C0", "label": "shutil import shutil", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.2222, 0.0185, 0, 0.66, 0.4286, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "shutil", "arg_names": [], "import_names": ["shutil"], "rhs_call_name": "", "annotation": ""}, "snippet": "import shutil"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1243:Import_L13_C0", "label": "commands import commands", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.2407, 0.0185, 0, 0.66, 0.5714, 760, 0, 1, 0, 0, 760, 0, 0], "semantic": {"name": "commands", "arg_names": [], "import_names": ["commands"], "rhs_call_name": "", "annotation": ""}, "snippet": "import commands"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1243:Expr_L15_C0", "label": "expression", "type": "expression", "loc": [15, 16], "level": 0, "parent": null, "vector": [8, 0, 0.287, 0.037, 0, 0.66, 0.7143, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Copy Special exercise\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1243:FunctionDef_L23_C0", "label": "main", "type": "function", "loc": [23, 48], "level": 0, "parent": null, "vector": [2, 0, 0.6574, 0.4815, 0, 0.66, 0.8571, 624, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n # This basic command line argument parsing code is provided.\n # Add code to call your functions below.\n\n # Make a list of command line arguments, omitting the [0] element\n # which is the script itself.\n args = sys.argv[1:]\n if not args:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1243:Assign_L29_C2", "label": "args =", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1243:FunctionDef_L23_C0", "vector": [14, 1, 0.537, 0.0185, 1, 0.07, 0.0, 805, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = sys.argv[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L30_C2", "label": "if", "type": "if", "loc": [30, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1243:FunctionDef_L23_C0", "vector": [4, 1, 0.5648, 0.037, 1, 0.07, 0.1667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not args:\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1243:Expr_L31_C4", "label": "exit()", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L30_C2", "vector": [8, 2, 0.5741, 0.0185, 2, 0.47, 0.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_1243:Assign_L36_C2", "label": "todir =", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1243:FunctionDef_L23_C0", "vector": [14, 1, 0.6667, 0.0185, 1, 0.07, 0.3333, 823, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "todir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " todir = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L37_C2", "label": "if", "type": "if", "loc": [37, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1243:FunctionDef_L23_C0", "vector": [4, 1, 0.7037, 0.0556, 1, 0.07, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args[0] == '--todir':\n todir = args[1]\n del args[0:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1243:Assign_L38_C4", "label": "todir =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L37_C2", "vector": [14, 2, 0.7037, 0.0185, 2, 0.94, 0.0, 823, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "todir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " todir = args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1243:Assign_L41_C2", "label": "tozip =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1243:FunctionDef_L23_C0", "vector": [14, 1, 0.7593, 0.0185, 1, 0.07, 0.6667, 721, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tozip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tozip = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L42_C2", "label": "if", "type": "if", "loc": [42, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1243:FunctionDef_L23_C0", "vector": [4, 1, 0.7963, 0.0556, 1, 0.07, 0.8333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args[0] == '--tozip':\n tozip = args[1]\n del args[0:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1243:Assign_L43_C4", "label": "tozip =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L42_C2", "vector": [14, 2, 0.7963, 0.0185, 2, 0.04, 0.0, 721, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tozip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tozip = args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L46_C2", "label": "if", "type": "if", "loc": [46, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1243:FunctionDef_L23_C0", "vector": [4, 1, 0.8704, 0.0556, 1, 0.07, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(args) == 0:\n print(\"error: must specify one or more dirs\")\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1243:Expr_L47_C4", "label": "print()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L46_C2", "vector": [8, 2, 0.8704, 0.0185, 2, 0.73, 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: must specify one or more dirs\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1243:Expr_L48_C4", "label": "exit()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L46_C2", "vector": [8, 2, 0.8889, 0.0185, 2, 0.73, 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_1243:If_L53_C0", "label": "if", "type": "if", "loc": [53, 54], "level": 0, "parent": null, "vector": [4, 0, 0.9907, 0.037, 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_1243:Expr_L54_C2", "label": "main()", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L53_C0", "vector": [8, 1, 1.0, 0.0185, 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_1243:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1243:Assign_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1243:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1243:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1243:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1243:Assign_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1243:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1243:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1243:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1243:Assign_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1243:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L42_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1243:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1243:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1243:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1243:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1243:If_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1243:Expr_L54_C2"}] |
#!/usr/bin/python
# 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/
import sys
import re
import os
import shutil
import commands
"""Copy Special exercise
"""
# +++your code here+++
# Write functions and modify main() to call them
def main():
# This basic command line argument parsing code is provided.
# Add code to call your functions below.
# Make a list of command line arguments, omitting the [0] element
# which is the script itself.
args = sys.argv[1:]
if not args:
print "usage: [--todir dir][--tozip zipfile] dir [dir ...]";
sys.exit(1)
# todir and tozip are either set from command line
# or left as the empty string.
# The args array is left just containing the dirs.
todir = ''
if args[0] == '--todir':
todir = args[1]
del args[0:2]
tozip = ''
if args[0] == '--tozip':
tozip = args[1]
del args[0:2]
if len(args) == 0:
print "error: must specify one or more dirs"
sys.exit(1)
# +++your code here+++
# Call your functions
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_1244 | 21 | 54 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1244:Import_L9_C0", "label": "sys import sys", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0185, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1244:Import_L10_C0", "label": "re import re", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1852, 0.0185, 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_1244:Import_L11_C0", "label": "os import os", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.2037, 0.0185, 0, 0.66, 0.2857, 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_1244:Import_L12_C0", "label": "shutil import shutil", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.2222, 0.0185, 0, 0.66, 0.4286, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "shutil", "arg_names": [], "import_names": ["shutil"], "rhs_call_name": "", "annotation": ""}, "snippet": "import shutil"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1244:Import_L13_C0", "label": "commands import commands", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.2407, 0.0185, 0, 0.66, 0.5714, 760, 0, 1, 0, 0, 760, 0, 0], "semantic": {"name": "commands", "arg_names": [], "import_names": ["commands"], "rhs_call_name": "", "annotation": ""}, "snippet": "import commands"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1244:Expr_L15_C0", "label": "expression", "type": "expression", "loc": [15, 16], "level": 0, "parent": null, "vector": [8, 0, 0.287, 0.037, 0, 0.66, 0.7143, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Copy Special exercise\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1244:FunctionDef_L23_C0", "label": "main", "type": "function", "loc": [23, 48], "level": 0, "parent": null, "vector": [2, 0, 0.6574, 0.4815, 0, 0.66, 0.8571, 624, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n # This basic command line argument parsing code is provided.\n # Add code to call your functions below.\n\n # Make a list of command line arguments, omitting the [0] element\n # which is the script itself.\n args = sys.argv[1:]\n if not args:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1244:Assign_L29_C2", "label": "args =", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1244:FunctionDef_L23_C0", "vector": [14, 1, 0.537, 0.0185, 1, 0.29, 0.0, 805, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = sys.argv[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L30_C2", "label": "if", "type": "if", "loc": [30, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1244:FunctionDef_L23_C0", "vector": [4, 1, 0.5648, 0.037, 1, 0.29, 0.1667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not args:\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1244:Expr_L31_C4", "label": "exit()", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L30_C2", "vector": [8, 2, 0.5741, 0.0185, 2, 0.11, 0.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_1244:Assign_L36_C2", "label": "todir =", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1244:FunctionDef_L23_C0", "vector": [14, 1, 0.6667, 0.0185, 1, 0.29, 0.3333, 823, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "todir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " todir = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L37_C2", "label": "if", "type": "if", "loc": [37, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1244:FunctionDef_L23_C0", "vector": [4, 1, 0.7037, 0.0556, 1, 0.29, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args[0] == '--todir':\n todir = args[1]\n del args[0:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1244:Assign_L38_C4", "label": "todir =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L37_C2", "vector": [14, 2, 0.7037, 0.0185, 2, 0.18, 0.0, 823, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "todir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " todir = args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1244:Assign_L41_C2", "label": "tozip =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1244:FunctionDef_L23_C0", "vector": [14, 1, 0.7593, 0.0185, 1, 0.29, 0.6667, 721, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tozip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tozip = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L42_C2", "label": "if", "type": "if", "loc": [42, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1244:FunctionDef_L23_C0", "vector": [4, 1, 0.7963, 0.0556, 1, 0.29, 0.8333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args[0] == '--tozip':\n tozip = args[1]\n del args[0:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1244:Assign_L43_C4", "label": "tozip =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L42_C2", "vector": [14, 2, 0.7963, 0.0185, 2, 0.64, 0.0, 721, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tozip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tozip = args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L46_C2", "label": "if", "type": "if", "loc": [46, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1244:FunctionDef_L23_C0", "vector": [4, 1, 0.8704, 0.0556, 1, 0.29, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(args) == 0:\n print(\"error: must specify one or more dirs\")\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1244:Expr_L47_C4", "label": "print()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L46_C2", "vector": [8, 2, 0.8704, 0.0185, 2, 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(\"error: must specify one or more dirs\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1244:Expr_L48_C4", "label": "exit()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L46_C2", "vector": [8, 2, 0.8889, 0.0185, 2, 0.85, 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_1244:If_L53_C0", "label": "if", "type": "if", "loc": [53, 54], "level": 0, "parent": null, "vector": [4, 0, 0.9907, 0.037, 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_1244:Expr_L54_C2", "label": "main()", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L53_C0", "vector": [8, 1, 1.0, 0.0185, 1, 0.27, 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_1244:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1244:Assign_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1244:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1244:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1244:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1244:Assign_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1244:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1244:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1244:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1244:Assign_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1244:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L42_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1244:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1244:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1244:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1244:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1244:If_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1244:Expr_L54_C2"}] |
#!/usr/bin/python
# 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/
import os
import re
import sys
import urllib
"""Logpuzzle exercise
Given an apache logfile, find the puzzle urls and download the images.
Here's what a puzzle url looks like:
10.254.254.28 - - [06/Aug/2007:00:13:48 -0700] "GET /~foo/puzzle-bar-aaab.jpg HTTP/1.0" 302 528 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"
"""
def read_urls(filename):
"""Returns a list of the puzzle urls from the given log file,
extracting the hostname from the filename itself.
Screens out duplicate urls and returns the urls sorted into
increasing order."""
# +++your code here+++
def download_images(img_urls, dest_dir):
"""Given the urls already in the correct order, downloads
each image into the given directory.
Gives the images local filenames img0, img1, and so on.
Creates an index.html in the directory
with an img tag to show each local image file.
Creates the directory if necessary.
"""
# +++your code here+++
def main():
args = sys.argv[1:]
if not args:
print 'usage: [--todir dir] logfile '
sys.exit(1)
todir = ''
if args[0] == '--todir':
todir = args[1]
del args[0:2]
img_urls = read_urls(args[0])
if todir:
download_images(img_urls, todir)
else:
print '\n'.join(img_urls)
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1245 | 23 | 61 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1245:Import_L9_C0", "label": "os import os", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1475, 0.0164, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1245:Import_L10_C0", "label": "re import re", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1639, 0.0164, 0, 0.66, 0.125, 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_1245:Import_L11_C0", "label": "sys import sys", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1803, 0.0164, 0, 0.66, 0.25, 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_1245:Import_L12_C0", "label": "urllib import urllib", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1967, 0.0164, 0, 0.66, 0.375, 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_1245:Expr_L14_C0", "label": "expression", "type": "expression", "loc": [14, 19], "level": 0, "parent": null, "vector": [8, 0, 0.2705, 0.0984, 0, 0.66, 0.5, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Logpuzzle exercise\nGiven an apache logfile, find the puzzle urls and download the images.\n\nHere's what a puzzle url looks like:\n10.254.254.28 - - [06/Aug/2007:00:13:48 -0700] \"GET /~foo/puzzle-bar-aaab.jpg HTTP/1.0\" 302 528 \"-\" \"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6\"\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1245:FunctionDef_L22_C0", "label": "read_urls", "type": "function", "loc": [22, 26], "level": 0, "parent": null, "vector": [2, 0, 0.3934, 0.082, 0, 0.66, 0.625, 7, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "read_urls", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def read_urls(filename):\n \"\"\"Returns a list of the puzzle urls from the given log file,\n extracting the hostname from the filename itself.\n Screens out duplicate urls and returns the urls sorted into\n increasing order.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1245:Expr_L23_C2", "label": "expression", "type": "expression", "loc": [23, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1245:FunctionDef_L22_C0", "vector": [8, 1, 0.4016, 0.0656, 1, 0.64, 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 puzzle urls from the given log file,\n extracting the hostname from the filename itself.\n Screens out duplicate urls and returns the urls sorted into\n increasing order.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1245:FunctionDef_L30_C0", "label": "download_images", "type": "function", "loc": [30, 37], "level": 0, "parent": null, "vector": [2, 0, 0.5492, 0.1311, 0, 0.66, 0.75, 106, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "download_images", "arg_names": ["img_urls", "dest_dir"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def download_images(img_urls, dest_dir):\n \"\"\"Given the urls already in the correct order, downloads\n each image into the given directory.\n Gives the images local filenames img0, img1, and so on.\n Creates an index.html in the directory\n with an img tag to show each local image file.\n Creates the directory if necessary.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1245:Expr_L31_C2", "label": "expression", "type": "expression", "loc": [31, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1245:FunctionDef_L30_C0", "vector": [8, 1, 0.5574, 0.1148, 1, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Given the urls already in the correct order, downloads\n each image into the given directory.\n Gives the images local filenames img0, img1, and so on.\n Creates an index.html in the directory\n with an img tag to show each local image file.\n Creates the directory if necessary.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1245:FunctionDef_L41_C0", "label": "main", "type": "function", "loc": [41, 58], "level": 0, "parent": null, "vector": [2, 0, 0.8115, 0.2951, 0, 0.66, 0.875, 624, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n args = sys.argv[1:]\n\n if not args:\n print('usage: [--todir dir] logfile ')\n sys.exit(1)\n\n todir = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1245:Assign_L42_C2", "label": "args =", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1245:FunctionDef_L41_C0", "vector": [14, 1, 0.6885, 0.0164, 1, 0.56, 0.0, 805, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = sys.argv[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1245:If_L44_C2", "label": "if", "type": "if", "loc": [44, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1245:FunctionDef_L41_C0", "vector": [4, 1, 0.7377, 0.0492, 1, 0.56, 0.2, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not args:\n print('usage: [--todir dir] logfile ')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1245:Expr_L45_C4", "label": "print()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1245:If_L44_C2", "vector": [8, 2, 0.7377, 0.0164, 2, 0.67, 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: [--todir dir] logfile ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1245:Expr_L46_C4", "label": "exit()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1245:If_L44_C2", "vector": [8, 2, 0.7541, 0.0164, 2, 0.67, 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_1245:Assign_L48_C2", "label": "todir =", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1245:FunctionDef_L41_C0", "vector": [14, 1, 0.7869, 0.0164, 1, 0.56, 0.4, 823, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "todir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " todir = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1245:If_L49_C2", "label": "if", "type": "if", "loc": [49, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1245:FunctionDef_L41_C0", "vector": [4, 1, 0.8197, 0.0492, 1, 0.56, 0.6, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args[0] == '--todir':\n todir = args[1]\n del args[0:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1245:Assign_L50_C4", "label": "todir =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1245:If_L49_C2", "vector": [14, 2, 0.8197, 0.0164, 2, 0.51, 0.0, 823, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "todir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " todir = args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1245:Assign_L53_C2", "label": "img_urls = read_urls()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1245:FunctionDef_L41_C0", "vector": [14, 1, 0.8689, 0.0164, 1, 0.56, 0.8, 27, 3, 1, 0, 0, 7, 10, 1], "semantic": {"name": "img_urls", "arg_names": [], "import_names": [], "rhs_call_name": "read_urls", "annotation": ""}, "snippet": " img_urls = read_urls(args[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1245:If_L55_C2", "label": "if", "type": "if", "loc": [55, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1245:FunctionDef_L41_C0", "vector": [4, 1, 0.9262, 0.0656, 1, 0.56, 1.0, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if todir:\n download_images(img_urls, todir)\n else:\n print('\\n'.join(img_urls))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1245:Expr_L56_C4", "label": "download_images()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1245:If_L55_C2", "vector": [8, 2, 0.918, 0.0164, 2, 0.0, 0.0, 106, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "download_images", "arg_names": [], "import_names": [], "rhs_call_name": "download_images", "annotation": ""}, "snippet": " download_images(img_urls, todir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1245:Expr_L58_C4", "label": "print()", "type": "expression", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1245:If_L55_C2", "vector": [8, 2, 0.9508, 0.0164, 2, 0.0, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\n'.join(img_urls))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1245:If_L60_C0", "label": "if", "type": "if", "loc": [60, 61], "level": 0, "parent": null, "vector": [4, 0, 0.9918, 0.0328, 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_1245:Expr_L61_C2", "label": "main()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1245:If_L60_C0", "vector": [8, 1, 1.0, 0.0164, 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_1245:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1245:Expr_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1245:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1245:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1245:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1245:Assign_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1245:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1245:If_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1245:If_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1245:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1245:If_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1245:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1245:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1245:Assign_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1245:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1245:If_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1245:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1245:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1245:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1245:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1245:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1245:If_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1245:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1245:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1245:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1245:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1245:If_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1245:Expr_L61_C2"}] |
#!/usr/bin/python
# 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/
import os
import re
import sys
import urllib
"""Logpuzzle exercise
Given an apache logfile, find the puzzle urls and download the images.
Here's what a puzzle url looks like:
10.254.254.28 - - [06/Aug/2007:00:13:48 -0700] "GET /~foo/puzzle-bar-aaab.jpg HTTP/1.0" 302 528 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"
"""
def read_urls(filename):
"""Returns a list of the puzzle urls from the given log file,
extracting the hostname from the filename itself.
Screens out duplicate urls and returns the urls sorted into
increasing order."""
# +++your code here+++
def download_images(img_urls, dest_dir):
"""Given the urls already in the correct order, downloads
each image into the given directory.
Gives the images local filenames img0, img1, and so on.
Creates an index.html in the directory
with an img tag to show each local image file.
Creates the directory if necessary.
"""
# +++your code here+++
def main():
args = sys.argv[1:]
if not args:
print 'usage: [--todir dir] logfile '
sys.exit(1)
todir = ''
if args[0] == '--todir':
todir = args[1]
del args[0:2]
img_urls = read_urls(args[0])
if todir:
download_images(img_urls, todir)
else:
print '\n'.join(img_urls)
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1246 | 23 | 61 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1246:Import_L9_C0", "label": "os import os", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1475, 0.0164, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1246:Import_L10_C0", "label": "re import re", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1639, 0.0164, 0, 0.66, 0.125, 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_1246:Import_L11_C0", "label": "sys import sys", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1803, 0.0164, 0, 0.66, 0.25, 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_1246:Import_L12_C0", "label": "urllib import urllib", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1967, 0.0164, 0, 0.66, 0.375, 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_1246:Expr_L14_C0", "label": "expression", "type": "expression", "loc": [14, 19], "level": 0, "parent": null, "vector": [8, 0, 0.2705, 0.0984, 0, 0.66, 0.5, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Logpuzzle exercise\nGiven an apache logfile, find the puzzle urls and download the images.\n\nHere's what a puzzle url looks like:\n10.254.254.28 - - [06/Aug/2007:00:13:48 -0700] \"GET /~foo/puzzle-bar-aaab.jpg HTTP/1.0\" 302 528 \"-\" \"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6\"\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1246:FunctionDef_L22_C0", "label": "read_urls", "type": "function", "loc": [22, 26], "level": 0, "parent": null, "vector": [2, 0, 0.3934, 0.082, 0, 0.66, 0.625, 7, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "read_urls", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def read_urls(filename):\n \"\"\"Returns a list of the puzzle urls from the given log file,\n extracting the hostname from the filename itself.\n Screens out duplicate urls and returns the urls sorted into\n increasing order.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1246:Expr_L23_C2", "label": "expression", "type": "expression", "loc": [23, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1246:FunctionDef_L22_C0", "vector": [8, 1, 0.4016, 0.0656, 1, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns a list of the puzzle urls from the given log file,\n extracting the hostname from the filename itself.\n Screens out duplicate urls and returns the urls sorted into\n increasing order.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1246:FunctionDef_L30_C0", "label": "download_images", "type": "function", "loc": [30, 37], "level": 0, "parent": null, "vector": [2, 0, 0.5492, 0.1311, 0, 0.66, 0.75, 106, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "download_images", "arg_names": ["img_urls", "dest_dir"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def download_images(img_urls, dest_dir):\n \"\"\"Given the urls already in the correct order, downloads\n each image into the given directory.\n Gives the images local filenames img0, img1, and so on.\n Creates an index.html in the directory\n with an img tag to show each local image file.\n Creates the directory if necessary.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1246:Expr_L31_C2", "label": "expression", "type": "expression", "loc": [31, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1246:FunctionDef_L30_C0", "vector": [8, 1, 0.5574, 0.1148, 1, 0.42, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Given the urls already in the correct order, downloads\n each image into the given directory.\n Gives the images local filenames img0, img1, and so on.\n Creates an index.html in the directory\n with an img tag to show each local image file.\n Creates the directory if necessary.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1246:FunctionDef_L41_C0", "label": "main", "type": "function", "loc": [41, 58], "level": 0, "parent": null, "vector": [2, 0, 0.8115, 0.2951, 0, 0.66, 0.875, 624, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n args = sys.argv[1:]\n\n if not args:\n print('usage: [--todir dir] logfile ')\n sys.exit(1)\n\n todir = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1246:Assign_L42_C2", "label": "args =", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1246:FunctionDef_L41_C0", "vector": [14, 1, 0.6885, 0.0164, 1, 0.88, 0.0, 805, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = sys.argv[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1246:If_L44_C2", "label": "if", "type": "if", "loc": [44, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1246:FunctionDef_L41_C0", "vector": [4, 1, 0.7377, 0.0492, 1, 0.88, 0.2, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not args:\n print('usage: [--todir dir] logfile ')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1246:Expr_L45_C4", "label": "print()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1246:If_L44_C2", "vector": [8, 2, 0.7377, 0.0164, 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: [--todir dir] logfile ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1246:Expr_L46_C4", "label": "exit()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1246:If_L44_C2", "vector": [8, 2, 0.7541, 0.0164, 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_1246:Assign_L48_C2", "label": "todir =", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1246:FunctionDef_L41_C0", "vector": [14, 1, 0.7869, 0.0164, 1, 0.88, 0.4, 823, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "todir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " todir = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1246:If_L49_C2", "label": "if", "type": "if", "loc": [49, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1246:FunctionDef_L41_C0", "vector": [4, 1, 0.8197, 0.0492, 1, 0.88, 0.6, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args[0] == '--todir':\n todir = args[1]\n del args[0:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1246:Assign_L50_C4", "label": "todir =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1246:If_L49_C2", "vector": [14, 2, 0.8197, 0.0164, 2, 0.15, 0.0, 823, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "todir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " todir = args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1246:Assign_L53_C2", "label": "img_urls = read_urls()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1246:FunctionDef_L41_C0", "vector": [14, 1, 0.8689, 0.0164, 1, 0.88, 0.8, 27, 3, 1, 0, 0, 7, 10, 1], "semantic": {"name": "img_urls", "arg_names": [], "import_names": [], "rhs_call_name": "read_urls", "annotation": ""}, "snippet": " img_urls = read_urls(args[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1246:If_L55_C2", "label": "if", "type": "if", "loc": [55, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1246:FunctionDef_L41_C0", "vector": [4, 1, 0.9262, 0.0656, 1, 0.88, 1.0, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if todir:\n download_images(img_urls, todir)\n else:\n print('\\n'.join(img_urls))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1246:Expr_L56_C4", "label": "download_images()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1246:If_L55_C2", "vector": [8, 2, 0.918, 0.0164, 2, 0.9, 0.0, 106, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "download_images", "arg_names": [], "import_names": [], "rhs_call_name": "download_images", "annotation": ""}, "snippet": " download_images(img_urls, todir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1246:Expr_L58_C4", "label": "print()", "type": "expression", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1246:If_L55_C2", "vector": [8, 2, 0.9508, 0.0164, 2, 0.9, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\n'.join(img_urls))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1246:If_L60_C0", "label": "if", "type": "if", "loc": [60, 61], "level": 0, "parent": null, "vector": [4, 0, 0.9918, 0.0328, 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_1246:Expr_L61_C2", "label": "main()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1246:If_L60_C0", "vector": [8, 1, 1.0, 0.0164, 1, 0.56, 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_1246:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1246:Expr_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1246:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1246:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1246:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1246:Assign_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1246:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1246:If_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1246:If_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1246:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1246:If_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1246:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1246:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1246:Assign_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1246:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1246:If_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1246:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1246:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1246:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1246:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1246:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1246:If_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1246:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1246:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1246:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1246:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1246:If_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1246:Expr_L61_C2"}] |
#!/usr/bin/python
def remove_adjacent(nums):
result = []
for num in nums:
if len(result) == 0 or num != result[-1]:
result.append(num)
return result
def linear_merge(list1, list2):
result = []
while len(list1) and len(list2):
if list1[0] < list2[0]:
result.append(list1.pop(0))
else:
result.append(list2.pop(0))
result.extend(list1)
result.extend(list2)
return result
def test(got, expected):
if got == expected:
prefix = ' OK '
else:
prefix = ' X '
print '%s got: %s expected: %s' % (prefix, repr(got), repr(expected))
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_1251 | 30 | 42 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L2_C0", "label": "remove_adjacent", "type": "function", "loc": [2, 7], "level": 0, "parent": null, "vector": [2, 0, 0.1071, 0.1429, 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 result = []\n for num in nums:\n if len(result) == 0 or num != result[-1]:\n result.append(num)\n return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1251:Assign_L3_C2", "label": "result =", "type": "assigned_variable", "loc": [3, 3], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L2_C0", "vector": [14, 1, 0.0714, 0.0238, 1, 0.22, 0.0, 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_1251:For_L4_C2", "label": "for num", "type": "for", "loc": [4, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L2_C0", "vector": [6, 1, 0.119, 0.0714, 1, 0.22, 0.5, 328, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for num in nums:\n if len(result) == 0 or num != result[-1]:\n result.append(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1251:If_L5_C4", "label": "if", "type": "if", "loc": [5, 6], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:For_L4_C2", "vector": [4, 2, 0.131, 0.0476, 2, 0.29, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(result) == 0 or num != result[-1]:\n result.append(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L6_C6", "label": "append()", "type": "expression", "loc": [6, 6], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:If_L5_C4", "vector": [8, 3, 0.1429, 0.0238, 3, 0.7, 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(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1251:Return_L7_C2", "label": "return", "type": "return", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L2_C0", "vector": [13, 1, 0.1667, 0.0238, 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 result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L9_C0", "label": "linear_merge", "type": "function", "loc": [9, 19], "level": 0, "parent": null, "vector": [2, 0, 0.3333, 0.2619, 0, 0.66, 0.25, 96, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "linear_merge", "arg_names": ["list1", "list2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def linear_merge(list1, list2):\n result = []\n while len(list1) and len(list2):\n if list1[0] < list2[0]:\n result.append(list1.pop(0))\n else:\n result.append(list2.pop(0))\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1251:Assign_L10_C2", "label": "result =", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L9_C0", "vector": [14, 1, 0.2381, 0.0238, 1, 0.05, 0.0, 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_1251:While_L11_C2", "label": "while", "type": "while", "loc": [11, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L9_C0", "vector": [5, 1, 0.3095, 0.119, 1, 0.05, 0.25, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while len(list1) and len(list2):\n if list1[0] < list2[0]:\n result.append(list1.pop(0))\n else:\n result.append(list2.pop(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1251:If_L12_C4", "label": "if", "type": "if", "loc": [12, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:While_L11_C2", "vector": [4, 2, 0.3214, 0.0952, 2, 0.38, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if list1[0] < list2[0]:\n result.append(list1.pop(0))\n else:\n result.append(list2.pop(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L13_C6", "label": "append()", "type": "expression", "loc": [13, 13], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:If_L12_C4", "vector": [8, 3, 0.3095, 0.0238, 3, 0.72, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " result.append(list1.pop(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L15_C6", "label": "append()", "type": "expression", "loc": [15, 15], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:If_L12_C4", "vector": [8, 3, 0.3571, 0.0238, 3, 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": " result.append(list2.pop(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L17_C2", "label": "extend()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L9_C0", "vector": [8, 1, 0.4048, 0.0238, 1, 0.05, 0.5, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " result.extend(list1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L18_C2", "label": "extend()", "type": "expression", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L9_C0", "vector": [8, 1, 0.4286, 0.0238, 1, 0.05, 0.75, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " result.extend(list2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1251:Return_L19_C2", "label": "return", "type": "return", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L9_C0", "vector": [13, 1, 0.4524, 0.0238, 1, 0.05, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L20_C0", "label": "test", "type": "function", "loc": [20, 25], "level": 0, "parent": null, "vector": [2, 0, 0.5357, 0.1429, 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_1251:If_L21_C2", "label": "if", "type": "if", "loc": [21, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L20_C0", "vector": [4, 1, 0.5357, 0.0952, 1, 0.34, 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_1251:Assign_L22_C4", "label": "prefix =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:If_L21_C2", "vector": [14, 2, 0.5238, 0.0238, 2, 0.46, 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_1251:Assign_L24_C4", "label": "prefix =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:If_L21_C2", "vector": [14, 2, 0.5714, 0.0238, 2, 0.46, 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_1251:Expr_L25_C2", "label": "print()", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L20_C0", "vector": [8, 1, 0.5952, 0.0238, 1, 0.34, 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_1251:FunctionDef_L27_C0", "label": "main", "type": "function", "loc": [27, 38], "level": 0, "parent": null, "vector": [2, 0, 0.7738, 0.2857, 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_1251:Expr_L28_C2", "label": "print()", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L27_C0", "vector": [8, 1, 0.6667, 0.0238, 1, 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('remove_adjacent')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L29_C2", "label": "test()", "type": "expression", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L27_C0", "vector": [8, 1, 0.6905, 0.0238, 1, 0.71, 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_1251:Expr_L30_C2", "label": "test()", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L27_C0", "vector": [8, 1, 0.7143, 0.0238, 1, 0.71, 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_1251:Expr_L31_C2", "label": "test()", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L27_C0", "vector": [8, 1, 0.7381, 0.0238, 1, 0.71, 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_1251:Expr_L33_C2", "label": "test()", "type": "expression", "loc": [33, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L27_C0", "vector": [8, 1, 0.7976, 0.0476, 1, 0.71, 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_1251:Expr_L35_C2", "label": "test()", "type": "expression", "loc": [35, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L27_C0", "vector": [8, 1, 0.8452, 0.0476, 1, 0.71, 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_1251:Expr_L37_C2", "label": "test()", "type": "expression", "loc": [37, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L27_C0", "vector": [8, 1, 0.8929, 0.0476, 1, 0.71, 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_1251:If_L41_C0", "label": "if", "type": "if", "loc": [41, 42], "level": 0, "parent": null, "vector": [4, 0, 0.9881, 0.0476, 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_1251:Expr_L42_C2", "label": "main()", "type": "expression", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1251:If_L41_C0", "vector": [8, 1, 1.0, 0.0238, 1, 0.31, 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_1251:FunctionDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Assign_L3_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:For_L4_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:For_L4_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:If_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:If_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L6_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Return_L7_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Assign_L10_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:While_L11_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:While_L11_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:If_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:If_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L13_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:If_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L15_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Return_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:If_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:If_L21_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:If_L21_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1251:If_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1251:Expr_L42_C2"}] |
#!/usr/bin/python
import sys
def words(filename):
count = {}
input_file = open(filename, 'r')
for line in input_file:
words = line.split()
for word in words:
word = word.lower()
if not word in count:
count[word] = 1
else:
count[word] = count[word] + 1
input_file.close()
return count
def print_words(filename):
"""Prints one per line '<word> <count>' sorted by word for the given file."""
count = words(filename)
words = sorted(count.keys())
for word in words:
print word, count[word]
def get_count(count_tuple):
"""Returns the count from a dict word/count tuple -- used for custom sort."""
return count_tuple[1]
def print_top(filename):
"""Prints the top count listing for the given file."""
count = words(filename)
items = sorted(count.items(), key=get_count, reverse=True)
for item in items[:20]:
print item[0], item[1]
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_1252 | 42 | 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_1252:Import_L4_C0", "label": "sys import sys", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0645, 0.0161, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L8_C0", "label": "words", "type": "function", "loc": [8, 20], "level": 0, "parent": null, "vector": [2, 0, 0.2258, 0.2097, 0, 0.66, 0.1667, 376, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "words", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def words(filename):\n count = {} \n input_file = open(filename, 'r')\n for line in input_file:\n words = line.split()\n for word in words:\n word = word.lower()\n if not word in count:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L9_C2", "label": "count =", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L8_C0", "vector": [14, 1, 0.1452, 0.0161, 1, 0.42, 0.0, 778, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count = {} "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L10_C2", "label": "input_file = open()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L8_C0", "vector": [14, 1, 0.1613, 0.0161, 1, 0.42, 0.25, 346, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "input_file", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " input_file = open(filename, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L11_C2", "label": "for line", "type": "for", "loc": [11, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L8_C0", "vector": [6, 1, 0.2339, 0.129, 1, 0.42, 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 input_file:\n words = line.split()\n for word in words:\n word = word.lower()\n if not word in count:\n count[word] = 1\n else:\n count[word] = count[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L12_C4", "label": "words = split()", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L11_C2", "vector": [14, 2, 0.1935, 0.0161, 2, 0.1, 0.0, 376, 3, 0, 0, 0, 908, 10, 1], "semantic": {"name": "words", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " words = line.split()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L13_C4", "label": "for word", "type": "for", "loc": [13, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L11_C2", "vector": [6, 2, 0.25, 0.0968, 2, 0.1, 1.0, 107, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for word in words:\n word = word.lower()\n if not word in count:\n count[word] = 1\n else:\n count[word] = count[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L14_C6", "label": "word = lower()", "type": "assigned_variable", "loc": [14, 14], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L13_C4", "vector": [14, 3, 0.2258, 0.0161, 3, 0.08, 0.0, 107, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " word = word.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L15_C6", "label": "if", "type": "if", "loc": [15, 18], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L13_C4", "vector": [4, 3, 0.2661, 0.0645, 3, 0.08, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not word in count:\n count[word] = 1\n else:\n count[word] = count[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L16_C8", "label": "assign", "type": "assigned_variable", "loc": [16, 16], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L15_C6", "vector": [14, 4, 0.2581, 0.0161, 4, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count[word] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L18_C8", "label": "assign", "type": "assigned_variable", "loc": [18, 18], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L15_C6", "vector": [14, 4, 0.2903, 0.0161, 4, 0.92, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count[word] = count[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:Expr_L19_C2", "label": "close()", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L8_C0", "vector": [8, 1, 0.3065, 0.0161, 1, 0.42, 0.75, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " input_file.close() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:Return_L20_C2", "label": "return", "type": "return", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L8_C0", "vector": [13, 1, 0.3226, 0.0161, 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 count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L23_C0", "label": "print_words", "type": "function", "loc": [23, 28], "level": 0, "parent": null, "vector": [2, 0, 0.4113, 0.0968, 0, 0.66, 0.3333, 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 \"\"\"Prints one per line '<word> <count>' sorted by word for the given file.\"\"\"\n count = words(filename)\n words = sorted(count.keys())\n for word in words:\n print(word, count[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:Expr_L24_C2", "label": "expression", "type": "expression", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L23_C0", "vector": [8, 1, 0.3871, 0.0161, 1, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Prints one per line '<word> <count>' sorted by word for the given file.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L25_C2", "label": "count = words()", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L23_C0", "vector": [14, 1, 0.4032, 0.0161, 1, 0.45, 0.3333, 778, 3, 1, 0, 0, 376, 10, 1], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "words", "annotation": ""}, "snippet": " count = words(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L26_C2", "label": "words = sorted()", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L23_C0", "vector": [14, 1, 0.4194, 0.0161, 1, 0.45, 0.6667, 376, 3, 1, 0, 0, 134, 10, 2], "semantic": {"name": "words", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " words = sorted(count.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L27_C2", "label": "for word", "type": "for", "loc": [27, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L23_C0", "vector": [6, 1, 0.4435, 0.0323, 1, 0.45, 1.0, 107, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for word in words:\n print(word, count[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:Expr_L28_C4", "label": "print()", "type": "expression", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L27_C2", "vector": [8, 2, 0.4516, 0.0161, 2, 0.81, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(word, count[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L31_C0", "label": "get_count", "type": "function", "loc": [31, 33], "level": 0, "parent": null, "vector": [2, 0, 0.5161, 0.0484, 0, 0.66, 0.5, 338, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_count", "arg_names": ["count_tuple"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_count(count_tuple):\n \"\"\"Returns the count from a dict word/count tuple -- used for custom sort.\"\"\"\n return count_tuple[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:Expr_L32_C2", "label": "expression", "type": "expression", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L31_C0", "vector": [8, 1, 0.5161, 0.0161, 1, 0.68, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns the count from a dict word/count tuple -- used for custom sort.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:Return_L33_C2", "label": "return", "type": "return", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L31_C0", "vector": [13, 1, 0.5323, 0.0161, 1, 0.68, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return count_tuple[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L36_C0", "label": "print_top", "type": "function", "loc": [36, 43], "level": 0, "parent": null, "vector": [2, 0, 0.6371, 0.129, 0, 0.66, 0.6667, 148, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "print_top", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_top(filename):\n \"\"\"Prints the top count listing for the given file.\"\"\"\n count = words(filename)\n\n items = sorted(count.items(), key=get_count, reverse=True)\n\n for item in items[:20]:\n print(item[0], item[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:Expr_L37_C2", "label": "expression", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L36_C0", "vector": [8, 1, 0.5968, 0.0161, 1, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Prints the top count listing for the given file.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L38_C2", "label": "count = words()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L36_C0", "vector": [14, 1, 0.6129, 0.0161, 1, 0.76, 0.3333, 778, 3, 1, 0, 0, 376, 10, 1], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "words", "annotation": ""}, "snippet": " count = words(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L40_C2", "label": "items = sorted()", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L36_C0", "vector": [14, 1, 0.6452, 0.0161, 1, 0.76, 0.6667, 339, 3, 3, 0, 0, 134, 10, 2], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " items = sorted(count.items(), key=get_count, reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L42_C2", "label": "for item", "type": "for", "loc": [42, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L36_C0", "vector": [6, 1, 0.6855, 0.0323, 1, 0.76, 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_1252:Expr_L43_C4", "label": "print()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L42_C2", "vector": [8, 2, 0.6935, 0.0161, 2, 0.89, 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_1252:FunctionDef_L46_C0", "label": "main", "type": "function", "loc": [46, 59], "level": 0, "parent": null, "vector": [2, 0, 0.8468, 0.2258, 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_1252:If_L47_C2", "label": "if", "type": "if", "loc": [47, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L46_C0", "vector": [4, 1, 0.7742, 0.0484, 1, 0.28, 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_1252:Expr_L48_C4", "label": "print()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L47_C2", "vector": [8, 2, 0.7742, 0.0161, 2, 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('usage: ./wordcount.py {--count | --topcount} file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1252:Expr_L49_C4", "label": "exit()", "type": "expression", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L47_C2", "vector": [8, 2, 0.7903, 0.0161, 2, 0.37, 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_1252:Assign_L51_C2", "label": "option =", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L46_C0", "vector": [14, 1, 0.8226, 0.0161, 1, 0.28, 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_1252:Assign_L52_C2", "label": "filename =", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L46_C0", "vector": [14, 1, 0.8387, 0.0161, 1, 0.28, 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_1252:If_L53_C2", "label": "if", "type": "if", "loc": [53, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L46_C0", "vector": [4, 1, 0.9032, 0.1129, 1, 0.28, 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_1252:Expr_L54_C4", "label": "print_words()", "type": "expression", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L53_C2", "vector": [8, 2, 0.871, 0.0161, 2, 0.35, 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_1252:If_L55_C2", "label": "if", "type": "if", "loc": [55, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L53_C2", "vector": [4, 2, 0.9194, 0.0806, 2, 0.35, 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_1252:Expr_L56_C4", "label": "print_top()", "type": "expression", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L55_C2", "vector": [8, 3, 0.9032, 0.0161, 3, 0.37, 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_1252:Expr_L58_C4", "label": "print()", "type": "expression", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L55_C2", "vector": [8, 3, 0.9355, 0.0161, 3, 0.37, 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_1252:Expr_L59_C4", "label": "exit()", "type": "expression", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L55_C2", "vector": [8, 3, 0.9516, 0.0161, 3, 0.37, 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_1252:If_L61_C0", "label": "if", "type": "if", "loc": [61, 62], "level": 0, "parent": null, "vector": [4, 0, 0.9919, 0.0323, 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_1252:Expr_L62_C2", "label": "main()", "type": "expression", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L61_C0", "vector": [8, 1, 1.0, 0.0161, 1, 0.38, 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_1252:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L9_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L10_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L11_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L11_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L11_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L14_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L15_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L15_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L15_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Expr_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Return_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Expr_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L27_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Expr_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Return_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Expr_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:For_L42_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L47_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L47_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Expr_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Assign_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Expr_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1252:If_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1252:Expr_L62_C2"}] |
#!/usr/bin/python
def remove_adjacent(nums):
result = []
for num in nums:
if len(result) == 0 or num != result[-1]:
result.append(num)
return result
def linear_merge(list1, list2):
result = []
while len(list1) and len(list2):
if list1[0] < list2[0]:
result.append(list1.pop(0))
else:
result.append(list2.pop(0))
result.extend(list1)
result.extend(list2)
return result
def test(got, expected):
if got == expected:
prefix = ' OK '
else:
prefix = ' X '
print '%s got: %s expected: %s' % (prefix, repr(got), repr(expected))
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_1254 | 30 | 42 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L2_C0", "label": "remove_adjacent", "type": "function", "loc": [2, 7], "level": 0, "parent": null, "vector": [2, 0, 0.1071, 0.1429, 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 result = []\n for num in nums:\n if len(result) == 0 or num != result[-1]:\n result.append(num)\n return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1254:Assign_L3_C2", "label": "result =", "type": "assigned_variable", "loc": [3, 3], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L2_C0", "vector": [14, 1, 0.0714, 0.0238, 1, 0.03, 0.0, 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_1254:For_L4_C2", "label": "for num", "type": "for", "loc": [4, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L2_C0", "vector": [6, 1, 0.119, 0.0714, 1, 0.03, 0.5, 328, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for num in nums:\n if len(result) == 0 or num != result[-1]:\n result.append(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1254:If_L5_C4", "label": "if", "type": "if", "loc": [5, 6], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:For_L4_C2", "vector": [4, 2, 0.131, 0.0476, 2, 0.98, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(result) == 0 or num != result[-1]:\n result.append(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1254:Expr_L6_C6", "label": "append()", "type": "expression", "loc": [6, 6], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:If_L5_C4", "vector": [8, 3, 0.1429, 0.0238, 3, 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": " result.append(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1254:Return_L7_C2", "label": "return", "type": "return", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L2_C0", "vector": [13, 1, 0.1667, 0.0238, 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 result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L9_C0", "label": "linear_merge", "type": "function", "loc": [9, 19], "level": 0, "parent": null, "vector": [2, 0, 0.3333, 0.2619, 0, 0.66, 0.25, 96, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "linear_merge", "arg_names": ["list1", "list2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def linear_merge(list1, list2):\n result = []\n while len(list1) and len(list2):\n if list1[0] < list2[0]:\n result.append(list1.pop(0))\n else:\n result.append(list2.pop(0))\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1254:Assign_L10_C2", "label": "result =", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L9_C0", "vector": [14, 1, 0.2381, 0.0238, 1, 0.62, 0.0, 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_1254:While_L11_C2", "label": "while", "type": "while", "loc": [11, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L9_C0", "vector": [5, 1, 0.3095, 0.119, 1, 0.62, 0.25, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while len(list1) and len(list2):\n if list1[0] < list2[0]:\n result.append(list1.pop(0))\n else:\n result.append(list2.pop(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1254:If_L12_C4", "label": "if", "type": "if", "loc": [12, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:While_L11_C2", "vector": [4, 2, 0.3214, 0.0952, 2, 0.25, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if list1[0] < list2[0]:\n result.append(list1.pop(0))\n else:\n result.append(list2.pop(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1254:Expr_L13_C6", "label": "append()", "type": "expression", "loc": [13, 13], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:If_L12_C4", "vector": [8, 3, 0.3095, 0.0238, 3, 0.28, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " result.append(list1.pop(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1254:Expr_L15_C6", "label": "append()", "type": "expression", "loc": [15, 15], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:If_L12_C4", "vector": [8, 3, 0.3571, 0.0238, 3, 0.28, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " result.append(list2.pop(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1254:Expr_L17_C2", "label": "extend()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L9_C0", "vector": [8, 1, 0.4048, 0.0238, 1, 0.62, 0.5, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " result.extend(list1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1254:Expr_L18_C2", "label": "extend()", "type": "expression", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L9_C0", "vector": [8, 1, 0.4286, 0.0238, 1, 0.62, 0.75, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " result.extend(list2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1254:Return_L19_C2", "label": "return", "type": "return", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L9_C0", "vector": [13, 1, 0.4524, 0.0238, 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 result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L20_C0", "label": "test", "type": "function", "loc": [20, 25], "level": 0, "parent": null, "vector": [2, 0, 0.5357, 0.1429, 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_1254:If_L21_C2", "label": "if", "type": "if", "loc": [21, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L20_C0", "vector": [4, 1, 0.5357, 0.0952, 1, 0.27, 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_1254:Assign_L22_C4", "label": "prefix =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:If_L21_C2", "vector": [14, 2, 0.5238, 0.0238, 2, 0.96, 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_1254:Assign_L24_C4", "label": "prefix =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:If_L21_C2", "vector": [14, 2, 0.5714, 0.0238, 2, 0.96, 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_1254:Expr_L25_C2", "label": "print()", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L20_C0", "vector": [8, 1, 0.5952, 0.0238, 1, 0.27, 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_1254:FunctionDef_L27_C0", "label": "main", "type": "function", "loc": [27, 38], "level": 0, "parent": null, "vector": [2, 0, 0.7738, 0.2857, 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_1254:Expr_L28_C2", "label": "print()", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L27_C0", "vector": [8, 1, 0.6667, 0.0238, 1, 0.44, 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_1254:Expr_L29_C2", "label": "test()", "type": "expression", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L27_C0", "vector": [8, 1, 0.6905, 0.0238, 1, 0.44, 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_1254:Expr_L30_C2", "label": "test()", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L27_C0", "vector": [8, 1, 0.7143, 0.0238, 1, 0.44, 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_1254:Expr_L31_C2", "label": "test()", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L27_C0", "vector": [8, 1, 0.7381, 0.0238, 1, 0.44, 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_1254:Expr_L33_C2", "label": "test()", "type": "expression", "loc": [33, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L27_C0", "vector": [8, 1, 0.7976, 0.0476, 1, 0.44, 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_1254:Expr_L35_C2", "label": "test()", "type": "expression", "loc": [35, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L27_C0", "vector": [8, 1, 0.8452, 0.0476, 1, 0.44, 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_1254:Expr_L37_C2", "label": "test()", "type": "expression", "loc": [37, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L27_C0", "vector": [8, 1, 0.8929, 0.0476, 1, 0.44, 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_1254:If_L41_C0", "label": "if", "type": "if", "loc": [41, 42], "level": 0, "parent": null, "vector": [4, 0, 0.9881, 0.0476, 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_1254:Expr_L42_C2", "label": "main()", "type": "expression", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1254:If_L41_C0", "vector": [8, 1, 1.0, 0.0238, 1, 0.58, 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_1254:FunctionDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Assign_L3_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:For_L4_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:For_L4_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:If_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:If_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Expr_L6_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Return_L7_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Assign_L10_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:While_L11_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:While_L11_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:If_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:If_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Expr_L13_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:If_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Expr_L15_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Expr_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Expr_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Return_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:If_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:If_L21_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:If_L21_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Expr_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Expr_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Expr_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Expr_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Expr_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Expr_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Expr_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1254:If_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1254:Expr_L42_C2"}] |
#!/usr/bin/python
import sys
def words(filename):
count = {}
input_file = open(filename, 'r')
for line in input_file:
words = line.split()
for word in words:
word = word.lower()
if not word in count:
count[word] = 1
else:
count[word] = count[word] + 1
input_file.close()
return count
def print_words(filename):
"""Prints one per line '<word> <count>' sorted by word for the given file."""
count = words(filename)
words = sorted(count.keys())
for word in words:
print word, count[word]
def get_count(count_tuple):
"""Returns the count from a dict word/count tuple -- used for custom sort."""
return count_tuple[1]
def print_top(filename):
"""Prints the top count listing for the given file."""
count = words(filename)
items = sorted(count.items(), key=get_count, reverse=True)
for item in items[:20]:
print item[0], item[1]
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_1255 | 42 | 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_1255:Import_L4_C0", "label": "sys import sys", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0645, 0.0161, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L8_C0", "label": "words", "type": "function", "loc": [8, 20], "level": 0, "parent": null, "vector": [2, 0, 0.2258, 0.2097, 0, 0.66, 0.1667, 376, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "words", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def words(filename):\n count = {} \n input_file = open(filename, 'r')\n for line in input_file:\n words = line.split()\n for word in words:\n word = word.lower()\n if not word in count:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L9_C2", "label": "count =", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L8_C0", "vector": [14, 1, 0.1452, 0.0161, 1, 0.58, 0.0, 778, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count = {} "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L10_C2", "label": "input_file = open()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L8_C0", "vector": [14, 1, 0.1613, 0.0161, 1, 0.58, 0.25, 346, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "input_file", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " input_file = open(filename, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L11_C2", "label": "for line", "type": "for", "loc": [11, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L8_C0", "vector": [6, 1, 0.2339, 0.129, 1, 0.58, 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 input_file:\n words = line.split()\n for word in words:\n word = word.lower()\n if not word in count:\n count[word] = 1\n else:\n count[word] = count[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L12_C4", "label": "words = split()", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L11_C2", "vector": [14, 2, 0.1935, 0.0161, 2, 0.28, 0.0, 376, 3, 0, 0, 0, 908, 10, 1], "semantic": {"name": "words", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " words = line.split()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L13_C4", "label": "for word", "type": "for", "loc": [13, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L11_C2", "vector": [6, 2, 0.25, 0.0968, 2, 0.28, 1.0, 107, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for word in words:\n word = word.lower()\n if not word in count:\n count[word] = 1\n else:\n count[word] = count[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L14_C6", "label": "word = lower()", "type": "assigned_variable", "loc": [14, 14], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L13_C4", "vector": [14, 3, 0.2258, 0.0161, 3, 0.61, 0.0, 107, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " word = word.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L15_C6", "label": "if", "type": "if", "loc": [15, 18], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L13_C4", "vector": [4, 3, 0.2661, 0.0645, 3, 0.61, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not word in count:\n count[word] = 1\n else:\n count[word] = count[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L16_C8", "label": "assign", "type": "assigned_variable", "loc": [16, 16], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L15_C6", "vector": [14, 4, 0.2581, 0.0161, 4, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count[word] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L18_C8", "label": "assign", "type": "assigned_variable", "loc": [18, 18], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L15_C6", "vector": [14, 4, 0.2903, 0.0161, 4, 0.12, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count[word] = count[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:Expr_L19_C2", "label": "close()", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L8_C0", "vector": [8, 1, 0.3065, 0.0161, 1, 0.58, 0.75, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " input_file.close() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:Return_L20_C2", "label": "return", "type": "return", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L8_C0", "vector": [13, 1, 0.3226, 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 count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L23_C0", "label": "print_words", "type": "function", "loc": [23, 28], "level": 0, "parent": null, "vector": [2, 0, 0.4113, 0.0968, 0, 0.66, 0.3333, 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 \"\"\"Prints one per line '<word> <count>' sorted by word for the given file.\"\"\"\n count = words(filename)\n words = sorted(count.keys())\n for word in words:\n print(word, count[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:Expr_L24_C2", "label": "expression", "type": "expression", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L23_C0", "vector": [8, 1, 0.3871, 0.0161, 1, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Prints one per line '<word> <count>' sorted by word for the given file.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L25_C2", "label": "count = words()", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L23_C0", "vector": [14, 1, 0.4032, 0.0161, 1, 0.03, 0.3333, 778, 3, 1, 0, 0, 376, 10, 1], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "words", "annotation": ""}, "snippet": " count = words(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L26_C2", "label": "words = sorted()", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L23_C0", "vector": [14, 1, 0.4194, 0.0161, 1, 0.03, 0.6667, 376, 3, 1, 0, 0, 134, 10, 2], "semantic": {"name": "words", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " words = sorted(count.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L27_C2", "label": "for word", "type": "for", "loc": [27, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L23_C0", "vector": [6, 1, 0.4435, 0.0323, 1, 0.03, 1.0, 107, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for word in words:\n print(word, count[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:Expr_L28_C4", "label": "print()", "type": "expression", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L27_C2", "vector": [8, 2, 0.4516, 0.0161, 2, 0.15, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(word, count[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L31_C0", "label": "get_count", "type": "function", "loc": [31, 33], "level": 0, "parent": null, "vector": [2, 0, 0.5161, 0.0484, 0, 0.66, 0.5, 338, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_count", "arg_names": ["count_tuple"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_count(count_tuple):\n \"\"\"Returns the count from a dict word/count tuple -- used for custom sort.\"\"\"\n return count_tuple[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:Expr_L32_C2", "label": "expression", "type": "expression", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L31_C0", "vector": [8, 1, 0.5161, 0.0161, 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 the count from a dict word/count tuple -- used for custom sort.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:Return_L33_C2", "label": "return", "type": "return", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L31_C0", "vector": [13, 1, 0.5323, 0.0161, 1, 0.27, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return count_tuple[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L36_C0", "label": "print_top", "type": "function", "loc": [36, 43], "level": 0, "parent": null, "vector": [2, 0, 0.6371, 0.129, 0, 0.66, 0.6667, 148, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "print_top", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_top(filename):\n \"\"\"Prints the top count listing for the given file.\"\"\"\n count = words(filename)\n\n items = sorted(count.items(), key=get_count, reverse=True)\n\n for item in items[:20]:\n print(item[0], item[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:Expr_L37_C2", "label": "expression", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L36_C0", "vector": [8, 1, 0.5968, 0.0161, 1, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Prints the top count listing for the given file.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L38_C2", "label": "count = words()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L36_C0", "vector": [14, 1, 0.6129, 0.0161, 1, 0.3, 0.3333, 778, 3, 1, 0, 0, 376, 10, 1], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "words", "annotation": ""}, "snippet": " count = words(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L40_C2", "label": "items = sorted()", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L36_C0", "vector": [14, 1, 0.6452, 0.0161, 1, 0.3, 0.6667, 339, 3, 3, 0, 0, 134, 10, 2], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " items = sorted(count.items(), key=get_count, reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L42_C2", "label": "for item", "type": "for", "loc": [42, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L36_C0", "vector": [6, 1, 0.6855, 0.0323, 1, 0.3, 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_1255:Expr_L43_C4", "label": "print()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L42_C2", "vector": [8, 2, 0.6935, 0.0161, 2, 0.99, 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_1255:FunctionDef_L46_C0", "label": "main", "type": "function", "loc": [46, 59], "level": 0, "parent": null, "vector": [2, 0, 0.8468, 0.2258, 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_1255:If_L47_C2", "label": "if", "type": "if", "loc": [47, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L46_C0", "vector": [4, 1, 0.7742, 0.0484, 1, 0.01, 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_1255:Expr_L48_C4", "label": "print()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L47_C2", "vector": [8, 2, 0.7742, 0.0161, 2, 0.28, 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_1255:Expr_L49_C4", "label": "exit()", "type": "expression", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L47_C2", "vector": [8, 2, 0.7903, 0.0161, 2, 0.28, 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_1255:Assign_L51_C2", "label": "option =", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L46_C0", "vector": [14, 1, 0.8226, 0.0161, 1, 0.01, 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_1255:Assign_L52_C2", "label": "filename =", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L46_C0", "vector": [14, 1, 0.8387, 0.0161, 1, 0.01, 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_1255:If_L53_C2", "label": "if", "type": "if", "loc": [53, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L46_C0", "vector": [4, 1, 0.9032, 0.1129, 1, 0.01, 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_1255:Expr_L54_C4", "label": "print_words()", "type": "expression", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L53_C2", "vector": [8, 2, 0.871, 0.0161, 2, 0.14, 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_1255:If_L55_C2", "label": "if", "type": "if", "loc": [55, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L53_C2", "vector": [4, 2, 0.9194, 0.0806, 2, 0.14, 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_1255:Expr_L56_C4", "label": "print_top()", "type": "expression", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L55_C2", "vector": [8, 3, 0.9032, 0.0161, 3, 0.59, 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_1255:Expr_L58_C4", "label": "print()", "type": "expression", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L55_C2", "vector": [8, 3, 0.9355, 0.0161, 3, 0.59, 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_1255:Expr_L59_C4", "label": "exit()", "type": "expression", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L55_C2", "vector": [8, 3, 0.9516, 0.0161, 3, 0.59, 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_1255:If_L61_C0", "label": "if", "type": "if", "loc": [61, 62], "level": 0, "parent": null, "vector": [4, 0, 0.9919, 0.0323, 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_1255:Expr_L62_C2", "label": "main()", "type": "expression", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L61_C0", "vector": [8, 1, 1.0, 0.0161, 1, 0.45, 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_1255:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L9_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L10_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L11_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L11_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L11_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L14_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L15_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L15_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L15_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Expr_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Return_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Expr_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L27_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Expr_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Return_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Expr_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:For_L42_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L47_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L47_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Expr_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Assign_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Expr_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1255:If_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1255:Expr_L62_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_1261 | 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_1261: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_1261:If_L16_C2", "label": "if", "type": "if", "loc": [16, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L15_C0", "vector": [4, 1, 0.2292, 0.0278, 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 nums == []:\n return nums"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1261:Return_L17_C4", "label": "return", "type": "return", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:If_L16_C2", "vector": [13, 2, 0.2361, 0.0139, 2, 0.79, 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_1261:Assign_L18_C2", "label": "last =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L15_C0", "vector": [14, 1, 0.25, 0.0139, 1, 0.37, 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_1261:Assign_L19_C2", "label": "mlist =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L15_C0", "vector": [14, 1, 0.2639, 0.0139, 1, 0.37, 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_1261:Expr_L20_C2", "label": "append()", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L15_C0", "vector": [8, 1, 0.2778, 0.0139, 1, 0.37, 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_1261:For_L21_C2", "label": "for i", "type": "for", "loc": [21, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L15_C0", "vector": [6, 1, 0.3125, 0.0556, 1, 0.37, 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_1261:If_L22_C4", "label": "if", "type": "if", "loc": [22, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261: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_1261:Expr_L23_C6", "label": "append()", "type": "expression", "loc": [23, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:If_L22_C4", "vector": [8, 3, 0.3194, 0.0139, 3, 0.66, 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_1261:Assign_L24_C4", "label": "last =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261: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_1261:Return_L25_C2", "label": "return", "type": "return", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L15_C0", "vector": [13, 1, 0.3472, 0.0139, 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 mlist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1261: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_1261:Expr_L33_C2", "label": "extend()", "type": "expression", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L32_C0", "vector": [8, 1, 0.4583, 0.0139, 1, 0.55, 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_1261:Expr_L34_C2", "label": "sort()", "type": "expression", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L32_C0", "vector": [8, 1, 0.4722, 0.0139, 1, 0.55, 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_1261:Return_L35_C2", "label": "return", "type": "return", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L32_C0", "vector": [13, 1, 0.4861, 0.0139, 1, 0.55, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return list1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1261: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_1261:If_L49_C2", "label": "if", "type": "if", "loc": [49, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L48_C0", "vector": [4, 1, 0.7014, 0.0556, 1, 0.57, 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_1261:Assign_L50_C4", "label": "prefix =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:If_L49_C2", "vector": [14, 2, 0.6944, 0.0139, 2, 0.18, 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_1261:Assign_L52_C4", "label": "prefix =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:If_L49_C2", "vector": [14, 2, 0.7222, 0.0139, 2, 0.18, 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_1261:Expr_L53_C2", "label": "print()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L48_C0", "vector": [8, 1, 0.7361, 0.0139, 1, 0.57, 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_1261: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_1261:Expr_L58_C2", "label": "print()", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L57_C0", "vector": [8, 1, 0.8056, 0.0139, 1, 0.55, 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_1261:Expr_L59_C2", "label": "test()", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L57_C0", "vector": [8, 1, 0.8194, 0.0139, 1, 0.55, 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_1261:Expr_L60_C2", "label": "test()", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L57_C0", "vector": [8, 1, 0.8333, 0.0139, 1, 0.55, 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_1261:Expr_L61_C2", "label": "test()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L57_C0", "vector": [8, 1, 0.8472, 0.0139, 1, 0.55, 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_1261:Expr_L63_C2", "label": "test()", "type": "expression", "loc": [63, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L57_C0", "vector": [8, 1, 0.8819, 0.0278, 1, 0.55, 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_1261:Expr_L65_C2", "label": "test()", "type": "expression", "loc": [65, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L57_C0", "vector": [8, 1, 0.9097, 0.0278, 1, 0.55, 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_1261:Expr_L67_C2", "label": "test()", "type": "expression", "loc": [67, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L57_C0", "vector": [8, 1, 0.9375, 0.0278, 1, 0.55, 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_1261: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_1261:Expr_L72_C2", "label": "main()", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1261:If_L71_C0", "vector": [8, 1, 1.0, 0.0139, 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_1261:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:If_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:If_L16_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Return_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Expr_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:For_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:For_L21_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:If_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Expr_L23_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:For_L21_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Return_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Expr_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Expr_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Return_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:If_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Expr_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Expr_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Expr_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Expr_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Expr_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Expr_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1261:Expr_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1261:If_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1261: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_1262 | 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_1262: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_1262: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_1262: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_1262: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_1262:Assign_L50_C2", "label": "f = open()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L49_C0", "vector": [14, 1, 0.5102, 0.0102, 1, 0.55, 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_1262:Assign_L51_C2", "label": "text = read()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L49_C0", "vector": [14, 1, 0.5204, 0.0102, 1, 0.55, 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_1262:Assign_L52_C2", "label": "text = sub()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L49_C0", "vector": [14, 1, 0.5306, 0.0102, 1, 0.55, 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_1262:Assign_L53_C2", "label": "text = lower()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L49_C0", "vector": [14, 1, 0.5408, 0.0102, 1, 0.55, 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_1262:Assign_L54_C2", "label": "words = split()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L49_C0", "vector": [14, 1, 0.551, 0.0102, 1, 0.55, 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_1262:Assign_L55_C2", "label": "wordsMap =", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L49_C0", "vector": [14, 1, 0.5612, 0.0102, 1, 0.55, 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_1262:For_L56_C2", "label": "for word", "type": "for", "loc": [56, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L49_C0", "vector": [6, 1, 0.5918, 0.051, 1, 0.55, 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_1262:If_L57_C4", "label": "if", "type": "if", "loc": [57, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:For_L56_C2", "vector": [4, 2, 0.5969, 0.0408, 2, 0.01, 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_1262:Assign_L60_C6", "label": "assign", "type": "assigned_variable", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L57_C4", "vector": [14, 3, 0.6122, 0.0102, 3, 0.81, 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_1262:Return_L62_C2", "label": "return", "type": "return", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L49_C0", "vector": [13, 1, 0.6327, 0.0102, 1, 0.55, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return wordsMap"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1262: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_1262:Assign_L67_C2", "label": "wordsMap = read_file()", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L66_C0", "vector": [14, 1, 0.6837, 0.0102, 1, 0.21, 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_1262:Assign_L68_C2", "label": "keys = sorted()", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L66_C0", "vector": [14, 1, 0.6939, 0.0102, 1, 0.21, 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_1262:For_L69_C2", "label": "for key", "type": "for", "loc": [69, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L66_C0", "vector": [6, 1, 0.7092, 0.0204, 1, 0.21, 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_1262:Expr_L70_C4", "label": "print()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:For_L69_C2", "vector": [8, 2, 0.7143, 0.0102, 2, 0.88, 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_1262:Return_L71_C2", "label": "return", "type": "return", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L66_C0", "vector": [13, 1, 0.7245, 0.0102, 1, 0.21, 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_1262: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_1262:Assign_L74_C2", "label": "wordsMap = read_file()", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L73_C0", "vector": [14, 1, 0.7551, 0.0102, 1, 0.5, 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_1262:For_L75_C2", "label": "for item", "type": "for", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L73_C0", "vector": [6, 1, 0.7704, 0.0204, 1, 0.5, 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_1262:Expr_L76_C4", "label": "print()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:For_L75_C2", "vector": [8, 2, 0.7755, 0.0102, 2, 0.67, 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_1262: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_1262:If_L83_C2", "label": "if", "type": "if", "loc": [83, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L82_C0", "vector": [4, 1, 0.8571, 0.0306, 1, 0.46, 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_1262:Expr_L84_C4", "label": "print()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L83_C2", "vector": [8, 2, 0.8571, 0.0102, 2, 0.95, 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_1262:Expr_L85_C4", "label": "exit()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L83_C2", "vector": [8, 2, 0.8673, 0.0102, 2, 0.95, 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_1262:Assign_L87_C2", "label": "option =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L82_C0", "vector": [14, 1, 0.8878, 0.0102, 1, 0.46, 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_1262:Assign_L88_C2", "label": "filename =", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L82_C0", "vector": [14, 1, 0.898, 0.0102, 1, 0.46, 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_1262:If_L89_C2", "label": "if", "type": "if", "loc": [89, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L82_C0", "vector": [4, 1, 0.9388, 0.0714, 1, 0.46, 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_1262:Expr_L90_C4", "label": "print_words()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L89_C2", "vector": [8, 2, 0.9184, 0.0102, 2, 0.63, 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_1262:If_L91_C2", "label": "if", "type": "if", "loc": [91, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L89_C2", "vector": [4, 2, 0.949, 0.051, 2, 0.63, 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_1262:Expr_L92_C4", "label": "print_top()", "type": "expression", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L91_C2", "vector": [8, 3, 0.9388, 0.0102, 3, 0.11, 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_1262:Expr_L94_C4", "label": "print()", "type": "expression", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L91_C2", "vector": [8, 3, 0.9592, 0.0102, 3, 0.11, 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_1262:Expr_L95_C4", "label": "exit()", "type": "expression", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L91_C2", "vector": [8, 3, 0.9694, 0.0102, 3, 0.11, 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_1262: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_1262:Expr_L98_C2", "label": "main()", "type": "expression", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L97_C0", "vector": [8, 1, 1.0, 0.0102, 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": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Assign_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Assign_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Assign_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Assign_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Assign_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:For_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:For_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Assign_L60_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Return_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Assign_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Assign_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:For_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:For_L69_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Return_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Assign_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:For_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:For_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Assign_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L89_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1262:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1262:If_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1262: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_1264 | 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_1264: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_1264:If_L16_C2", "label": "if", "type": "if", "loc": [16, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L15_C0", "vector": [4, 1, 0.2292, 0.0278, 1, 0.18, 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_1264:Return_L17_C4", "label": "return", "type": "return", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:If_L16_C2", "vector": [13, 2, 0.2361, 0.0139, 2, 0.4, 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_1264:Assign_L18_C2", "label": "last =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L15_C0", "vector": [14, 1, 0.25, 0.0139, 1, 0.18, 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_1264:Assign_L19_C2", "label": "mlist =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L15_C0", "vector": [14, 1, 0.2639, 0.0139, 1, 0.18, 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_1264:Expr_L20_C2", "label": "append()", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L15_C0", "vector": [8, 1, 0.2778, 0.0139, 1, 0.18, 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_1264:For_L21_C2", "label": "for i", "type": "for", "loc": [21, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L15_C0", "vector": [6, 1, 0.3125, 0.0556, 1, 0.18, 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_1264:If_L22_C4", "label": "if", "type": "if", "loc": [22, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:For_L21_C2", "vector": [4, 2, 0.3125, 0.0278, 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 i!= last:\n mlist.append(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1264:Expr_L23_C6", "label": "append()", "type": "expression", "loc": [23, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:If_L22_C4", "vector": [8, 3, 0.3194, 0.0139, 3, 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": " mlist.append(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1264:Assign_L24_C4", "label": "last =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:For_L21_C2", "vector": [14, 2, 0.3333, 0.0139, 2, 0.42, 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_1264:Return_L25_C2", "label": "return", "type": "return", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L15_C0", "vector": [13, 1, 0.3472, 0.0139, 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 mlist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1264: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_1264:Expr_L33_C2", "label": "extend()", "type": "expression", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L32_C0", "vector": [8, 1, 0.4583, 0.0139, 1, 0.2, 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_1264:Expr_L34_C2", "label": "sort()", "type": "expression", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L32_C0", "vector": [8, 1, 0.4722, 0.0139, 1, 0.2, 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_1264:Return_L35_C2", "label": "return", "type": "return", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L32_C0", "vector": [13, 1, 0.4861, 0.0139, 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 list1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1264: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_1264:If_L49_C2", "label": "if", "type": "if", "loc": [49, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L48_C0", "vector": [4, 1, 0.7014, 0.0556, 1, 0.35, 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_1264:Assign_L50_C4", "label": "prefix =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:If_L49_C2", "vector": [14, 2, 0.6944, 0.0139, 2, 0.15, 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_1264:Assign_L52_C4", "label": "prefix =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:If_L49_C2", "vector": [14, 2, 0.7222, 0.0139, 2, 0.15, 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_1264:Expr_L53_C2", "label": "print()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L48_C0", "vector": [8, 1, 0.7361, 0.0139, 1, 0.35, 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_1264: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_1264:Expr_L58_C2", "label": "print()", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L57_C0", "vector": [8, 1, 0.8056, 0.0139, 1, 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('remove_adjacent')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1264:Expr_L59_C2", "label": "test()", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L57_C0", "vector": [8, 1, 0.8194, 0.0139, 1, 0.76, 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_1264:Expr_L60_C2", "label": "test()", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L57_C0", "vector": [8, 1, 0.8333, 0.0139, 1, 0.76, 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_1264:Expr_L61_C2", "label": "test()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L57_C0", "vector": [8, 1, 0.8472, 0.0139, 1, 0.76, 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_1264:Expr_L63_C2", "label": "test()", "type": "expression", "loc": [63, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L57_C0", "vector": [8, 1, 0.8819, 0.0278, 1, 0.76, 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_1264:Expr_L65_C2", "label": "test()", "type": "expression", "loc": [65, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L57_C0", "vector": [8, 1, 0.9097, 0.0278, 1, 0.76, 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_1264:Expr_L67_C2", "label": "test()", "type": "expression", "loc": [67, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L57_C0", "vector": [8, 1, 0.9375, 0.0278, 1, 0.76, 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_1264: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_1264:Expr_L72_C2", "label": "main()", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1264:If_L71_C0", "vector": [8, 1, 1.0, 0.0139, 1, 0.14, 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_1264:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:If_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:If_L16_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Return_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Expr_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:For_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:For_L21_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:If_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Expr_L23_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:For_L21_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Return_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Expr_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Expr_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Return_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:If_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Expr_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Expr_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Expr_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Expr_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Expr_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Expr_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1264:Expr_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1264:If_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1264: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_1265 | 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_1265: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_1265: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_1265: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_1265: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_1265:Assign_L50_C2", "label": "f = open()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L49_C0", "vector": [14, 1, 0.5102, 0.0102, 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_1265:Assign_L51_C2", "label": "text = read()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L49_C0", "vector": [14, 1, 0.5204, 0.0102, 1, 0.48, 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_1265:Assign_L52_C2", "label": "text = sub()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L49_C0", "vector": [14, 1, 0.5306, 0.0102, 1, 0.48, 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_1265:Assign_L53_C2", "label": "text = lower()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L49_C0", "vector": [14, 1, 0.5408, 0.0102, 1, 0.48, 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_1265:Assign_L54_C2", "label": "words = split()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L49_C0", "vector": [14, 1, 0.551, 0.0102, 1, 0.48, 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_1265:Assign_L55_C2", "label": "wordsMap =", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L49_C0", "vector": [14, 1, 0.5612, 0.0102, 1, 0.48, 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_1265:For_L56_C2", "label": "for word", "type": "for", "loc": [56, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L49_C0", "vector": [6, 1, 0.5918, 0.051, 1, 0.48, 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_1265:If_L57_C4", "label": "if", "type": "if", "loc": [57, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:For_L56_C2", "vector": [4, 2, 0.5969, 0.0408, 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 word in wordsMap:\n wordsMap[word] +=1\n else:\n wordsMap[word] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1265:Assign_L60_C6", "label": "assign", "type": "assigned_variable", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L57_C4", "vector": [14, 3, 0.6122, 0.0102, 3, 0.68, 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_1265:Return_L62_C2", "label": "return", "type": "return", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L49_C0", "vector": [13, 1, 0.6327, 0.0102, 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 wordsMap"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1265: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_1265:Assign_L67_C2", "label": "wordsMap = read_file()", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L66_C0", "vector": [14, 1, 0.6837, 0.0102, 1, 0.17, 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_1265:Assign_L68_C2", "label": "keys = sorted()", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L66_C0", "vector": [14, 1, 0.6939, 0.0102, 1, 0.17, 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_1265:For_L69_C2", "label": "for key", "type": "for", "loc": [69, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L66_C0", "vector": [6, 1, 0.7092, 0.0204, 1, 0.17, 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_1265:Expr_L70_C4", "label": "print()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:For_L69_C2", "vector": [8, 2, 0.7143, 0.0102, 2, 0.73, 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_1265:Return_L71_C2", "label": "return", "type": "return", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L66_C0", "vector": [13, 1, 0.7245, 0.0102, 1, 0.17, 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_1265: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_1265:Assign_L74_C2", "label": "wordsMap = read_file()", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L73_C0", "vector": [14, 1, 0.7551, 0.0102, 1, 0.18, 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_1265:For_L75_C2", "label": "for item", "type": "for", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L73_C0", "vector": [6, 1, 0.7704, 0.0204, 1, 0.18, 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_1265:Expr_L76_C4", "label": "print()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:For_L75_C2", "vector": [8, 2, 0.7755, 0.0102, 2, 0.77, 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_1265: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_1265:If_L83_C2", "label": "if", "type": "if", "loc": [83, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L82_C0", "vector": [4, 1, 0.8571, 0.0306, 1, 0.89, 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_1265:Expr_L84_C4", "label": "print()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L83_C2", "vector": [8, 2, 0.8571, 0.0102, 2, 0.6, 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_1265:Expr_L85_C4", "label": "exit()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L83_C2", "vector": [8, 2, 0.8673, 0.0102, 2, 0.6, 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_1265:Assign_L87_C2", "label": "option =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L82_C0", "vector": [14, 1, 0.8878, 0.0102, 1, 0.89, 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_1265:Assign_L88_C2", "label": "filename =", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L82_C0", "vector": [14, 1, 0.898, 0.0102, 1, 0.89, 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_1265:If_L89_C2", "label": "if", "type": "if", "loc": [89, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L82_C0", "vector": [4, 1, 0.9388, 0.0714, 1, 0.89, 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_1265:Expr_L90_C4", "label": "print_words()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L89_C2", "vector": [8, 2, 0.9184, 0.0102, 2, 0.45, 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_1265:If_L91_C2", "label": "if", "type": "if", "loc": [91, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L89_C2", "vector": [4, 2, 0.949, 0.051, 2, 0.45, 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_1265:Expr_L92_C4", "label": "print_top()", "type": "expression", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L91_C2", "vector": [8, 3, 0.9388, 0.0102, 3, 0.81, 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_1265:Expr_L94_C4", "label": "print()", "type": "expression", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L91_C2", "vector": [8, 3, 0.9592, 0.0102, 3, 0.81, 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_1265:Expr_L95_C4", "label": "exit()", "type": "expression", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L91_C2", "vector": [8, 3, 0.9694, 0.0102, 3, 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_1265: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_1265:Expr_L98_C2", "label": "main()", "type": "expression", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L97_C0", "vector": [8, 1, 1.0, 0.0102, 1, 0.93, 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_1265:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Assign_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Assign_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Assign_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Assign_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Assign_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:For_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:For_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Assign_L60_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Return_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Assign_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Assign_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:For_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:For_L69_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Return_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Assign_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:For_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:For_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Assign_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L89_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1265:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1265:If_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1265: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."""
# +++your code here+++
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=[]
#print(mimic)
return mimic
def print_mimic(mimic_dict, word):
"""Given mimic dict and start word, prints 200 random words."""
# +++your code here+++
if mimic_dict==0:
print "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_1268 | 41 | 99 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1268:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 42], "level": 0, "parent": null, "vector": [8, 0, 0.2576, 0.3434, 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_1268:Import_L44_C0", "label": "random import random", "type": "import", "loc": [44, 44], "level": 0, "parent": null, "vector": [1, 0, 0.4444, 0.0101, 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_1268:Import_L45_C0", "label": "sys import sys", "type": "import", "loc": [45, 45], "level": 0, "parent": null, "vector": [1, 0, 0.4545, 0.0101, 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_1268:Import_L46_C0", "label": "re import re", "type": "import", "loc": [46, 46], "level": 0, "parent": null, "vector": [1, 0, 0.4646, 0.0101, 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_1268:FunctionDef_L49_C0", "label": "mimic_dict", "type": "function", "loc": [49, 69], "level": 0, "parent": null, "vector": [2, 0, 0.596, 0.2121, 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 # +++your code here+++\n f=open(filename,'r')\n text=f.read()\n text=re.sub(\"[(/.,!?:-;`)]\",\"\",text)\n lines=text.lower().split()\n #if len(lines)==0:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1268:Expr_L50_C2", "label": "expression", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L49_C0", "vector": [8, 1, 0.5051, 0.0101, 1, 0.86, 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_1268:Assign_L52_C2", "label": "f = open()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L49_C0", "vector": [14, 1, 0.5253, 0.0101, 1, 0.86, 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_1268:Assign_L53_C2", "label": "text = read()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L49_C0", "vector": [14, 1, 0.5354, 0.0101, 1, 0.86, 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_1268:Assign_L54_C2", "label": "text = sub()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L49_C0", "vector": [14, 1, 0.5455, 0.0101, 1, 0.86, 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_1268:Assign_L55_C2", "label": "lines = split()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L49_C0", "vector": [14, 1, 0.5556, 0.0101, 1, 0.86, 0.5, 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_1268:Assign_L58_C2", "label": "mimic =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L49_C0", "vector": [14, 1, 0.5859, 0.0101, 1, 0.86, 0.625, 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_1268:Assign_L59_C2", "label": "suf =", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L49_C0", "vector": [14, 1, 0.596, 0.0101, 1, 0.86, 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_1268:For_L60_C2", "label": "for i", "type": "for", "loc": [60, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L49_C0", "vector": [6, 1, 0.6414, 0.0808, 1, 0.86, 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(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_1268:If_L61_C4", "label": "if", "type": "if", "loc": [61, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:For_L60_C2", "vector": [4, 2, 0.6465, 0.0707, 2, 0.25, 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_1268:Assign_L62_C6", "label": "j =", "type": "assigned_variable", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L61_C4", "vector": [14, 3, 0.6263, 0.0101, 3, 0.78, 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_1268:For_L63_C6", "label": "for j", "type": "for", "loc": [63, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L61_C4", "vector": [6, 3, 0.6465, 0.0303, 3, 0.78, 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_1268:If_L64_C8", "label": "if", "type": "if", "loc": [64, 65], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:For_L63_C6", "vector": [4, 4, 0.6515, 0.0202, 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 lines[i]==lines[j]:\n suf.append(lines[j+1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1268:Expr_L65_C10", "label": "append()", "type": "expression", "loc": [65, 65], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L64_C8", "vector": [8, 5, 0.6566, 0.0101, 5, 0.0, 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_1268:Expr_L66_C6", "label": "update()", "type": "expression", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L61_C4", "vector": [8, 3, 0.6667, 0.0101, 3, 0.78, 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_1268:Assign_L67_C6", "label": "suf =", "type": "assigned_variable", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L61_C4", "vector": [14, 3, 0.6768, 0.0101, 3, 0.78, 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_1268:Return_L69_C2", "label": "return", "type": "return", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L49_C0", "vector": [13, 1, 0.697, 0.0101, 1, 0.86, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return mimic"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L72_C0", "label": "print_mimic", "type": "function", "loc": [72, 85], "level": 0, "parent": null, "vector": [2, 0, 0.7929, 0.1414, 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 if mimic_dict==0:\n print(\"File is empty\")\n return\n for i in range(200):\n if word=='' or mimic_dict.get(word)==[]:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1268:Expr_L73_C2", "label": "expression", "type": "expression", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L72_C0", "vector": [8, 1, 0.7374, 0.0101, 1, 0.77, 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_1268:If_L75_C2", "label": "if", "type": "if", "loc": [75, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L72_C0", "vector": [4, 1, 0.7677, 0.0303, 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 mimic_dict==0:\n print(\"File is empty\")\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1268:Expr_L76_C4", "label": "print()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L75_C2", "vector": [8, 2, 0.7677, 0.0101, 2, 0.19, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"File is empty\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1268:Return_L77_C4", "label": "return", "type": "return", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L75_C2", "vector": [13, 2, 0.7778, 0.0101, 2, 0.19, 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_1268:For_L78_C2", "label": "for i", "type": "for", "loc": [78, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L72_C0", "vector": [6, 1, 0.8182, 0.0707, 1, 0.77, 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_1268:If_L79_C4", "label": "if", "type": "if", "loc": [79, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:For_L78_C2", "vector": [4, 2, 0.8232, 0.0606, 2, 0.87, 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_1268:Assign_L80_C6", "label": "word = get()", "type": "assigned_variable", "loc": [80, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L79_C4", "vector": [14, 3, 0.8081, 0.0101, 3, 0.22, 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_1268:Expr_L81_C6", "label": "write()", "type": "expression", "loc": [81, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L79_C4", "vector": [8, 3, 0.8182, 0.0101, 3, 0.22, 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_1268:Assign_L83_C6", "label": "word = choice()", "type": "assigned_variable", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L79_C4", "vector": [14, 3, 0.8384, 0.0101, 3, 0.22, 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_1268:Expr_L84_C6", "label": "write()", "type": "expression", "loc": [84, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L79_C4", "vector": [8, 3, 0.8485, 0.0101, 3, 0.22, 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_1268:Return_L85_C2", "label": "return", "type": "return", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L72_C0", "vector": [13, 1, 0.8586, 0.0101, 1, 0.77, 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_1268:FunctionDef_L89_C0", "label": "main", "type": "function", "loc": [89, 95], "level": 0, "parent": null, "vector": [2, 0, 0.9293, 0.0707, 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_1268:If_L90_C2", "label": "if", "type": "if", "loc": [90, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L89_C0", "vector": [4, 1, 0.9192, 0.0303, 1, 0.58, 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_1268:Expr_L91_C4", "label": "print()", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L90_C2", "vector": [8, 2, 0.9192, 0.0101, 2, 0.73, 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_1268:Expr_L92_C4", "label": "exit()", "type": "expression", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L90_C2", "vector": [8, 2, 0.9293, 0.0101, 2, 0.73, 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_1268:Assign_L94_C2", "label": "dict = mimic_dict()", "type": "assigned_variable", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L89_C0", "vector": [14, 1, 0.9495, 0.0101, 1, 0.58, 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_1268:Expr_L95_C2", "label": "print_mimic()", "type": "expression", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L89_C0", "vector": [8, 1, 0.9596, 0.0101, 1, 0.58, 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_1268:If_L98_C0", "label": "if", "type": "if", "loc": [98, 99], "level": 0, "parent": null, "vector": [4, 0, 0.9949, 0.0202, 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_1268:Expr_L99_C2", "label": "main()", "type": "expression", "loc": [99, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L98_C0", "vector": [8, 1, 1.0, 0.0101, 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": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Expr_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Assign_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Assign_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Assign_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Assign_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Assign_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:For_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:For_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Assign_L62_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:For_L63_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:For_L63_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L64_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Expr_L65_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Expr_L66_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Assign_L67_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Return_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Expr_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Return_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:For_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:For_L78_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Assign_L80_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Expr_L81_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Assign_L83_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Expr_L84_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Return_L85_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Expr_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Assign_L94_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Expr_L95_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1268:If_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1268:Expr_L99_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+++
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):
# +++your code here+++
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()
input()
| ajibawa-2023/Python-Code-Large/train/row_1272 | 26 | 70 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L15_C0", "label": "remove_adjacent", "type": "function", "loc": [15, 22], "level": 0, "parent": null, "vector": [2, 0, 0.2643, 0.1143, 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 # +++your code here+++\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_1272:Assign_L17_C2", "label": "i =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L15_C0", "vector": [14, 1, 0.2429, 0.0143, 1, 0.32, 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_1272:Assign_L18_C2", "label": "newlist =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L15_C0", "vector": [14, 1, 0.2571, 0.0143, 1, 0.32, 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_1272:For_L19_C2", "label": "for i", "type": "for", "loc": [19, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L15_C0", "vector": [6, 1, 0.2857, 0.0429, 1, 0.32, 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_1272:If_L20_C4", "label": "if", "type": "if", "loc": [20, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:For_L19_C2", "vector": [4, 2, 0.2929, 0.0286, 2, 0.93, 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_1272:Expr_L21_C6", "label": "append()", "type": "expression", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:If_L20_C4", "vector": [8, 3, 0.3, 0.0143, 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": " newlist.append(nums[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1272:Return_L22_C2", "label": "return", "type": "return", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L15_C0", "vector": [13, 1, 0.3143, 0.0143, 1, 0.32, 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_1272:FunctionDef_L29_C0", "label": "linear_merge", "type": "function", "loc": [29, 32], "level": 0, "parent": null, "vector": [2, 0, 0.4357, 0.0571, 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 # +++your code here+++\n list1.extend(list2)\n return sorted(list1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1272:Expr_L31_C2", "label": "extend()", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L29_C0", "vector": [8, 1, 0.4429, 0.0143, 1, 0.84, 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_1272:Return_L32_C2", "label": "return", "type": "return", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L29_C0", "vector": [13, 1, 0.4571, 0.0143, 1, 0.84, 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_1272:FunctionDef_L45_C0", "label": "test", "type": "function", "loc": [45, 50], "level": 0, "parent": null, "vector": [2, 0, 0.6786, 0.0857, 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_1272:If_L46_C2", "label": "if", "type": "if", "loc": [46, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L45_C0", "vector": [4, 1, 0.6786, 0.0571, 1, 0.02, 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_1272:Assign_L47_C4", "label": "prefix =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:If_L46_C2", "vector": [14, 2, 0.6714, 0.0143, 2, 0.57, 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_1272:Assign_L49_C4", "label": "prefix =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:If_L46_C2", "vector": [14, 2, 0.7, 0.0143, 2, 0.57, 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_1272:Expr_L50_C2", "label": "print()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L45_C0", "vector": [8, 1, 0.7143, 0.0143, 1, 0.02, 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_1272:FunctionDef_L54_C0", "label": "main", "type": "function", "loc": [54, 65], "level": 0, "parent": null, "vector": [2, 0, 0.85, 0.1714, 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_1272:Expr_L55_C2", "label": "print()", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L54_C0", "vector": [8, 1, 0.7857, 0.0143, 1, 0.4, 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_1272:Expr_L56_C2", "label": "test()", "type": "expression", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L54_C0", "vector": [8, 1, 0.8, 0.0143, 1, 0.4, 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_1272:Expr_L57_C2", "label": "test()", "type": "expression", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L54_C0", "vector": [8, 1, 0.8143, 0.0143, 1, 0.4, 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_1272:Expr_L58_C2", "label": "test()", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L54_C0", "vector": [8, 1, 0.8286, 0.0143, 1, 0.4, 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_1272:Expr_L60_C2", "label": "test()", "type": "expression", "loc": [60, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L54_C0", "vector": [8, 1, 0.8643, 0.0286, 1, 0.4, 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_1272:Expr_L62_C2", "label": "test()", "type": "expression", "loc": [62, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L54_C0", "vector": [8, 1, 0.8929, 0.0286, 1, 0.4, 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_1272:Expr_L64_C2", "label": "test()", "type": "expression", "loc": [64, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L54_C0", "vector": [8, 1, 0.9214, 0.0286, 1, 0.4, 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_1272:If_L68_C0", "label": "if", "type": "if", "loc": [68, 70], "level": 0, "parent": null, "vector": [4, 0, 0.9857, 0.0429, 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 main()\n input()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1272:Expr_L69_C2", "label": "main()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:If_L68_C0", "vector": [8, 1, 0.9857, 0.0143, 1, 0.33, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1272:Expr_L70_C2", "label": "input()", "type": "expression", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1272:If_L68_C0", "vector": [8, 1, 1.0, 0.0143, 1, 0.33, 1.0, 930, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "input", "arg_names": [], "import_names": [], "rhs_call_name": "input", "annotation": ""}, "snippet": " input()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:Assign_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:For_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:For_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:If_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:If_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:Expr_L21_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:Return_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:Return_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:If_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:If_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:If_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:Expr_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:Expr_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:Expr_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:Expr_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:Expr_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:Expr_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:Expr_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:Expr_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1272:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1272:Expr_L70_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 readfile(filename):
f=open(filename,'r')
text=f.read()
text=re.sub("[/.,!?;]", "",text)
lines=sorted(text.lower().split())
newlines=[]
i=1
#newlines.append(lines[0])
#newlines.append(lines.count(lines[0]))
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=sorted(readfile(filename), key=lambda tuples:tuples[-1:])
for i in range (len(arr)):
print arr[i][0],'\t',arr[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_1273 | 42 | 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_1273: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_1273: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_1273: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_1273:FunctionDef_L44_C0", "label": "readfile", "type": "function", "loc": [44, 60], "level": 0, "parent": null, "vector": [2, 0, 0.5306, 0.1735, 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 #newlines.append(lines[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1273:Assign_L45_C2", "label": "f = open()", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L44_C0", "vector": [14, 1, 0.4592, 0.0102, 1, 0.42, 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_1273:Assign_L46_C2", "label": "text = read()", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L44_C0", "vector": [14, 1, 0.4694, 0.0102, 1, 0.42, 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_1273:Assign_L47_C2", "label": "text = sub()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L44_C0", "vector": [14, 1, 0.4796, 0.0102, 1, 0.42, 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_1273:Assign_L48_C2", "label": "lines = sorted()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L44_C0", "vector": [14, 1, 0.4898, 0.0102, 1, 0.42, 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_1273:Assign_L49_C2", "label": "newlines =", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L44_C0", "vector": [14, 1, 0.5, 0.0102, 1, 0.42, 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_1273:Assign_L50_C2", "label": "i =", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L44_C0", "vector": [14, 1, 0.5102, 0.0102, 1, 0.42, 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_1273:For_L53_C2", "label": "for i", "type": "for", "loc": [53, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L44_C0", "vector": [6, 1, 0.5561, 0.0408, 1, 0.42, 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_1273:If_L54_C4", "label": "if", "type": "if", "loc": [54, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:For_L53_C2", "vector": [4, 2, 0.5612, 0.0306, 2, 0.69, 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_1273:Expr_L55_C6", "label": "append()", "type": "expression", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L54_C4", "vector": [8, 3, 0.5612, 0.0102, 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": " newlines.append(lines[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1273:Expr_L56_C6", "label": "append()", "type": "expression", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L54_C4", "vector": [8, 3, 0.5714, 0.0102, 3, 0.95, 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_1273:Assign_L57_C2", "label": "arr =", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L44_C0", "vector": [14, 1, 0.5816, 0.0102, 1, 0.42, 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_1273:For_L58_C2", "label": "for i", "type": "for", "loc": [58, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L44_C0", "vector": [6, 1, 0.5969, 0.0204, 1, 0.42, 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_1273:Expr_L59_C4", "label": "append()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:For_L58_C2", "vector": [8, 2, 0.602, 0.0102, 2, 0.81, 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_1273:Return_L60_C2", "label": "return", "type": "return", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L44_C0", "vector": [13, 1, 0.6122, 0.0102, 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 arr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L62_C0", "label": "print_words", "type": "function", "loc": [62, 66], "level": 0, "parent": null, "vector": [2, 0, 0.6531, 0.051, 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_1273:Assign_L63_C2", "label": "arr = readfile()", "type": "assigned_variable", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L62_C0", "vector": [14, 1, 0.6429, 0.0102, 1, 0.11, 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_1273:For_L64_C2", "label": "for i", "type": "for", "loc": [64, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L62_C0", "vector": [6, 1, 0.6582, 0.0204, 1, 0.11, 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_1273:Expr_L65_C4", "label": "print()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:For_L64_C2", "vector": [8, 2, 0.6633, 0.0102, 2, 0.77, 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_1273:Return_L66_C2", "label": "return", "type": "return", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L62_C0", "vector": [13, 1, 0.6735, 0.0102, 1, 0.11, 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_1273:FunctionDef_L68_C0", "label": "print_top", "type": "function", "loc": [68, 72], "level": 0, "parent": null, "vector": [2, 0, 0.7143, 0.051, 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=sorted(readfile(filename), key=lambda tuples:tuples[-1:])\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_1273:Assign_L69_C2", "label": "arr = sorted()", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L68_C0", "vector": [14, 1, 0.7041, 0.0102, 1, 0.52, 0.0, 395, 3, 2, 0, 0, 134, 10, 2], "semantic": {"name": "arr", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " arr=sorted(readfile(filename), key=lambda tuples:tuples[-1:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1273:For_L70_C2", "label": "for i", "type": "for", "loc": [70, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L68_C0", "vector": [6, 1, 0.7194, 0.0204, 1, 0.52, 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_1273:Expr_L71_C4", "label": "print()", "type": "expression", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:For_L70_C2", "vector": [8, 2, 0.7245, 0.0102, 2, 0.01, 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_1273:Return_L72_C2", "label": "return", "type": "return", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L68_C0", "vector": [13, 1, 0.7347, 0.0102, 1, 0.52, 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_1273: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_1273:If_L83_C2", "label": "if", "type": "if", "loc": [83, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L82_C0", "vector": [4, 1, 0.8571, 0.0306, 1, 0.7, 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_1273:Expr_L84_C4", "label": "print()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L83_C2", "vector": [8, 2, 0.8571, 0.0102, 2, 0.3, 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_1273:Expr_L85_C4", "label": "exit()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L83_C2", "vector": [8, 2, 0.8673, 0.0102, 2, 0.3, 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_1273:Assign_L87_C2", "label": "option =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L82_C0", "vector": [14, 1, 0.8878, 0.0102, 1, 0.7, 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_1273:Assign_L88_C2", "label": "filename =", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L82_C0", "vector": [14, 1, 0.898, 0.0102, 1, 0.7, 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_1273:If_L89_C2", "label": "if", "type": "if", "loc": [89, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L82_C0", "vector": [4, 1, 0.9388, 0.0714, 1, 0.7, 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_1273:Expr_L90_C4", "label": "print_words()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L89_C2", "vector": [8, 2, 0.9184, 0.0102, 2, 0.3, 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_1273:If_L91_C2", "label": "if", "type": "if", "loc": [91, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L89_C2", "vector": [4, 2, 0.949, 0.051, 2, 0.3, 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_1273:Expr_L92_C4", "label": "print_top()", "type": "expression", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L91_C2", "vector": [8, 3, 0.9388, 0.0102, 3, 0.75, 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_1273:Expr_L94_C4", "label": "print()", "type": "expression", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L91_C2", "vector": [8, 3, 0.9592, 0.0102, 3, 0.75, 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_1273:Expr_L95_C4", "label": "exit()", "type": "expression", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L91_C2", "vector": [8, 3, 0.9694, 0.0102, 3, 0.75, 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_1273: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_1273:Expr_L98_C2", "label": "main()", "type": "expression", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L97_C0", "vector": [8, 1, 1.0, 0.0102, 1, 0.55, 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_1273:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Assign_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Assign_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Assign_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Assign_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Assign_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Assign_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:For_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:For_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Expr_L55_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Expr_L56_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Assign_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:For_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:For_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Expr_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Return_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Assign_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:For_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:For_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Expr_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Return_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Assign_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:For_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:For_L70_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Expr_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Return_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Assign_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L89_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1273:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1273:If_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1273: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."""
# +++your code here+++
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=[]
#print(mimic)
return mimic
def print_mimic(mimic_dict, word):
"""Given mimic dict and start word, prints 200 random words."""
# +++your code here+++
if mimic_dict==0:
print "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_1274 | 41 | 99 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1274:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 42], "level": 0, "parent": null, "vector": [8, 0, 0.2576, 0.3434, 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_1274:Import_L44_C0", "label": "random import random", "type": "import", "loc": [44, 44], "level": 0, "parent": null, "vector": [1, 0, 0.4444, 0.0101, 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_1274:Import_L45_C0", "label": "sys import sys", "type": "import", "loc": [45, 45], "level": 0, "parent": null, "vector": [1, 0, 0.4545, 0.0101, 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_1274:Import_L46_C0", "label": "re import re", "type": "import", "loc": [46, 46], "level": 0, "parent": null, "vector": [1, 0, 0.4646, 0.0101, 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_1274:FunctionDef_L49_C0", "label": "mimic_dict", "type": "function", "loc": [49, 69], "level": 0, "parent": null, "vector": [2, 0, 0.596, 0.2121, 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 # +++your code here+++\n f=open(filename,'r')\n text=f.read()\n text=re.sub(\"[(/.,!?:-;`)]\",\"\",text)\n lines=text.lower().split()\n #if len(lines)==0:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1274:Expr_L50_C2", "label": "expression", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L49_C0", "vector": [8, 1, 0.5051, 0.0101, 1, 0.47, 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_1274:Assign_L52_C2", "label": "f = open()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L49_C0", "vector": [14, 1, 0.5253, 0.0101, 1, 0.47, 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_1274:Assign_L53_C2", "label": "text = read()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L49_C0", "vector": [14, 1, 0.5354, 0.0101, 1, 0.47, 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_1274:Assign_L54_C2", "label": "text = sub()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L49_C0", "vector": [14, 1, 0.5455, 0.0101, 1, 0.47, 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_1274:Assign_L55_C2", "label": "lines = split()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L49_C0", "vector": [14, 1, 0.5556, 0.0101, 1, 0.47, 0.5, 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_1274:Assign_L58_C2", "label": "mimic =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L49_C0", "vector": [14, 1, 0.5859, 0.0101, 1, 0.47, 0.625, 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_1274:Assign_L59_C2", "label": "suf =", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L49_C0", "vector": [14, 1, 0.596, 0.0101, 1, 0.47, 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_1274:For_L60_C2", "label": "for i", "type": "for", "loc": [60, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L49_C0", "vector": [6, 1, 0.6414, 0.0808, 1, 0.47, 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(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_1274:If_L61_C4", "label": "if", "type": "if", "loc": [61, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:For_L60_C2", "vector": [4, 2, 0.6465, 0.0707, 2, 0.72, 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_1274:Assign_L62_C6", "label": "j =", "type": "assigned_variable", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L61_C4", "vector": [14, 3, 0.6263, 0.0101, 3, 0.7, 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_1274:For_L63_C6", "label": "for j", "type": "for", "loc": [63, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L61_C4", "vector": [6, 3, 0.6465, 0.0303, 3, 0.7, 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_1274:If_L64_C8", "label": "if", "type": "if", "loc": [64, 65], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:For_L63_C6", "vector": [4, 4, 0.6515, 0.0202, 4, 0.34, 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_1274:Expr_L65_C10", "label": "append()", "type": "expression", "loc": [65, 65], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L64_C8", "vector": [8, 5, 0.6566, 0.0101, 5, 0.05, 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_1274:Expr_L66_C6", "label": "update()", "type": "expression", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L61_C4", "vector": [8, 3, 0.6667, 0.0101, 3, 0.7, 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_1274:Assign_L67_C6", "label": "suf =", "type": "assigned_variable", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L61_C4", "vector": [14, 3, 0.6768, 0.0101, 3, 0.7, 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_1274:Return_L69_C2", "label": "return", "type": "return", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L49_C0", "vector": [13, 1, 0.697, 0.0101, 1, 0.47, 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_1274:FunctionDef_L72_C0", "label": "print_mimic", "type": "function", "loc": [72, 85], "level": 0, "parent": null, "vector": [2, 0, 0.7929, 0.1414, 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 if mimic_dict==0:\n print(\"File is empty\")\n return\n for i in range(200):\n if word=='' or mimic_dict.get(word)==[]:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1274:Expr_L73_C2", "label": "expression", "type": "expression", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L72_C0", "vector": [8, 1, 0.7374, 0.0101, 1, 0.84, 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_1274:If_L75_C2", "label": "if", "type": "if", "loc": [75, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L72_C0", "vector": [4, 1, 0.7677, 0.0303, 1, 0.84, 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(\"File is empty\")\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1274:Expr_L76_C4", "label": "print()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L75_C2", "vector": [8, 2, 0.7677, 0.0101, 2, 0.53, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"File is empty\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1274:Return_L77_C4", "label": "return", "type": "return", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L75_C2", "vector": [13, 2, 0.7778, 0.0101, 2, 0.53, 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_1274:For_L78_C2", "label": "for i", "type": "for", "loc": [78, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L72_C0", "vector": [6, 1, 0.8182, 0.0707, 1, 0.84, 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_1274:If_L79_C4", "label": "if", "type": "if", "loc": [79, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:For_L78_C2", "vector": [4, 2, 0.8232, 0.0606, 2, 0.63, 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_1274:Assign_L80_C6", "label": "word = get()", "type": "assigned_variable", "loc": [80, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L79_C4", "vector": [14, 3, 0.8081, 0.0101, 3, 0.02, 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_1274:Expr_L81_C6", "label": "write()", "type": "expression", "loc": [81, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L79_C4", "vector": [8, 3, 0.8182, 0.0101, 3, 0.02, 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_1274:Assign_L83_C6", "label": "word = choice()", "type": "assigned_variable", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L79_C4", "vector": [14, 3, 0.8384, 0.0101, 3, 0.02, 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_1274:Expr_L84_C6", "label": "write()", "type": "expression", "loc": [84, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L79_C4", "vector": [8, 3, 0.8485, 0.0101, 3, 0.02, 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_1274:Return_L85_C2", "label": "return", "type": "return", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L72_C0", "vector": [13, 1, 0.8586, 0.0101, 1, 0.84, 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_1274:FunctionDef_L89_C0", "label": "main", "type": "function", "loc": [89, 95], "level": 0, "parent": null, "vector": [2, 0, 0.9293, 0.0707, 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_1274:If_L90_C2", "label": "if", "type": "if", "loc": [90, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L89_C0", "vector": [4, 1, 0.9192, 0.0303, 1, 0.14, 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_1274:Expr_L91_C4", "label": "print()", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L90_C2", "vector": [8, 2, 0.9192, 0.0101, 2, 0.03, 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_1274:Expr_L92_C4", "label": "exit()", "type": "expression", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L90_C2", "vector": [8, 2, 0.9293, 0.0101, 2, 0.03, 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_1274:Assign_L94_C2", "label": "dict = mimic_dict()", "type": "assigned_variable", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L89_C0", "vector": [14, 1, 0.9495, 0.0101, 1, 0.14, 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_1274:Expr_L95_C2", "label": "print_mimic()", "type": "expression", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L89_C0", "vector": [8, 1, 0.9596, 0.0101, 1, 0.14, 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_1274:If_L98_C0", "label": "if", "type": "if", "loc": [98, 99], "level": 0, "parent": null, "vector": [4, 0, 0.9949, 0.0202, 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_1274:Expr_L99_C2", "label": "main()", "type": "expression", "loc": [99, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L98_C0", "vector": [8, 1, 1.0, 0.0101, 1, 0.03, 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_1274:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Expr_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Assign_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Assign_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Assign_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Assign_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Assign_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:For_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:For_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Assign_L62_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:For_L63_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:For_L63_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L64_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Expr_L65_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Expr_L66_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Assign_L67_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Return_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Expr_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Return_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:For_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:For_L78_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Assign_L80_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Expr_L81_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Assign_L83_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Expr_L84_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Return_L85_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Expr_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Assign_L94_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Expr_L95_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1274:If_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1274:Expr_L99_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+++
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):
# +++your code here+++
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()
input()
| ajibawa-2023/Python-Code-Large/train/row_1276 | 26 | 70 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L15_C0", "label": "remove_adjacent", "type": "function", "loc": [15, 22], "level": 0, "parent": null, "vector": [2, 0, 0.2643, 0.1143, 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 # +++your code here+++\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_1276:Assign_L17_C2", "label": "i =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L15_C0", "vector": [14, 1, 0.2429, 0.0143, 1, 0.57, 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_1276:Assign_L18_C2", "label": "newlist =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L15_C0", "vector": [14, 1, 0.2571, 0.0143, 1, 0.57, 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_1276:For_L19_C2", "label": "for i", "type": "for", "loc": [19, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L15_C0", "vector": [6, 1, 0.2857, 0.0429, 1, 0.57, 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_1276:If_L20_C4", "label": "if", "type": "if", "loc": [20, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:For_L19_C2", "vector": [4, 2, 0.2929, 0.0286, 2, 0.41, 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_1276:Expr_L21_C6", "label": "append()", "type": "expression", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:If_L20_C4", "vector": [8, 3, 0.3, 0.0143, 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": " newlist.append(nums[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1276:Return_L22_C2", "label": "return", "type": "return", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L15_C0", "vector": [13, 1, 0.3143, 0.0143, 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 newlist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L29_C0", "label": "linear_merge", "type": "function", "loc": [29, 32], "level": 0, "parent": null, "vector": [2, 0, 0.4357, 0.0571, 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 # +++your code here+++\n list1.extend(list2)\n return sorted(list1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1276:Expr_L31_C2", "label": "extend()", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L29_C0", "vector": [8, 1, 0.4429, 0.0143, 1, 0.62, 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_1276:Return_L32_C2", "label": "return", "type": "return", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L29_C0", "vector": [13, 1, 0.4571, 0.0143, 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 sorted(list1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L45_C0", "label": "test", "type": "function", "loc": [45, 50], "level": 0, "parent": null, "vector": [2, 0, 0.6786, 0.0857, 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_1276:If_L46_C2", "label": "if", "type": "if", "loc": [46, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L45_C0", "vector": [4, 1, 0.6786, 0.0571, 1, 0.89, 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_1276:Assign_L47_C4", "label": "prefix =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:If_L46_C2", "vector": [14, 2, 0.6714, 0.0143, 2, 0.46, 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_1276:Assign_L49_C4", "label": "prefix =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:If_L46_C2", "vector": [14, 2, 0.7, 0.0143, 2, 0.46, 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_1276:Expr_L50_C2", "label": "print()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L45_C0", "vector": [8, 1, 0.7143, 0.0143, 1, 0.89, 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_1276:FunctionDef_L54_C0", "label": "main", "type": "function", "loc": [54, 65], "level": 0, "parent": null, "vector": [2, 0, 0.85, 0.1714, 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_1276:Expr_L55_C2", "label": "print()", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L54_C0", "vector": [8, 1, 0.7857, 0.0143, 1, 0.87, 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_1276:Expr_L56_C2", "label": "test()", "type": "expression", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L54_C0", "vector": [8, 1, 0.8, 0.0143, 1, 0.87, 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_1276:Expr_L57_C2", "label": "test()", "type": "expression", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L54_C0", "vector": [8, 1, 0.8143, 0.0143, 1, 0.87, 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_1276:Expr_L58_C2", "label": "test()", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L54_C0", "vector": [8, 1, 0.8286, 0.0143, 1, 0.87, 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_1276:Expr_L60_C2", "label": "test()", "type": "expression", "loc": [60, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L54_C0", "vector": [8, 1, 0.8643, 0.0286, 1, 0.87, 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_1276:Expr_L62_C2", "label": "test()", "type": "expression", "loc": [62, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L54_C0", "vector": [8, 1, 0.8929, 0.0286, 1, 0.87, 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_1276:Expr_L64_C2", "label": "test()", "type": "expression", "loc": [64, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L54_C0", "vector": [8, 1, 0.9214, 0.0286, 1, 0.87, 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_1276:If_L68_C0", "label": "if", "type": "if", "loc": [68, 70], "level": 0, "parent": null, "vector": [4, 0, 0.9857, 0.0429, 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 main()\n input()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1276:Expr_L69_C2", "label": "main()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:If_L68_C0", "vector": [8, 1, 0.9857, 0.0143, 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": " main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1276:Expr_L70_C2", "label": "input()", "type": "expression", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1276:If_L68_C0", "vector": [8, 1, 1.0, 0.0143, 1, 0.1, 1.0, 930, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "input", "arg_names": [], "import_names": [], "rhs_call_name": "input", "annotation": ""}, "snippet": " input()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:Assign_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:For_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:For_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:If_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:If_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:Expr_L21_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:Return_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:Return_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:If_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:If_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:If_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:Expr_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:Expr_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:Expr_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:Expr_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:Expr_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:Expr_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:Expr_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:Expr_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1276:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1276:Expr_L70_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 readfile(filename):
f=open(filename,'r')
text=f.read()
text=re.sub("[/.,!?;]", "",text)
lines=sorted(text.lower().split())
newlines=[]
i=1
#newlines.append(lines[0])
#newlines.append(lines.count(lines[0]))
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=sorted(readfile(filename), key=lambda tuples:tuples[-1:])
for i in range (len(arr)):
print arr[i][0],'\t',arr[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_1277 | 42 | 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_1277: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_1277: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_1277: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_1277:FunctionDef_L44_C0", "label": "readfile", "type": "function", "loc": [44, 60], "level": 0, "parent": null, "vector": [2, 0, 0.5306, 0.1735, 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 #newlines.append(lines[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1277:Assign_L45_C2", "label": "f = open()", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L44_C0", "vector": [14, 1, 0.4592, 0.0102, 1, 0.42, 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_1277:Assign_L46_C2", "label": "text = read()", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L44_C0", "vector": [14, 1, 0.4694, 0.0102, 1, 0.42, 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_1277:Assign_L47_C2", "label": "text = sub()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L44_C0", "vector": [14, 1, 0.4796, 0.0102, 1, 0.42, 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_1277:Assign_L48_C2", "label": "lines = sorted()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L44_C0", "vector": [14, 1, 0.4898, 0.0102, 1, 0.42, 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_1277:Assign_L49_C2", "label": "newlines =", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L44_C0", "vector": [14, 1, 0.5, 0.0102, 1, 0.42, 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_1277:Assign_L50_C2", "label": "i =", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L44_C0", "vector": [14, 1, 0.5102, 0.0102, 1, 0.42, 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_1277:For_L53_C2", "label": "for i", "type": "for", "loc": [53, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L44_C0", "vector": [6, 1, 0.5561, 0.0408, 1, 0.42, 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_1277:If_L54_C4", "label": "if", "type": "if", "loc": [54, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:For_L53_C2", "vector": [4, 2, 0.5612, 0.0306, 2, 0.17, 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_1277:Expr_L55_C6", "label": "append()", "type": "expression", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L54_C4", "vector": [8, 3, 0.5612, 0.0102, 3, 0.94, 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_1277:Expr_L56_C6", "label": "append()", "type": "expression", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L54_C4", "vector": [8, 3, 0.5714, 0.0102, 3, 0.94, 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_1277:Assign_L57_C2", "label": "arr =", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L44_C0", "vector": [14, 1, 0.5816, 0.0102, 1, 0.42, 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_1277:For_L58_C2", "label": "for i", "type": "for", "loc": [58, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L44_C0", "vector": [6, 1, 0.5969, 0.0204, 1, 0.42, 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_1277:Expr_L59_C4", "label": "append()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:For_L58_C2", "vector": [8, 2, 0.602, 0.0102, 2, 0.63, 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_1277:Return_L60_C2", "label": "return", "type": "return", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L44_C0", "vector": [13, 1, 0.6122, 0.0102, 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 arr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L62_C0", "label": "print_words", "type": "function", "loc": [62, 66], "level": 0, "parent": null, "vector": [2, 0, 0.6531, 0.051, 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_1277:Assign_L63_C2", "label": "arr = readfile()", "type": "assigned_variable", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L62_C0", "vector": [14, 1, 0.6429, 0.0102, 1, 0.79, 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_1277:For_L64_C2", "label": "for i", "type": "for", "loc": [64, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L62_C0", "vector": [6, 1, 0.6582, 0.0204, 1, 0.79, 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_1277:Expr_L65_C4", "label": "print()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:For_L64_C2", "vector": [8, 2, 0.6633, 0.0102, 2, 0.24, 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_1277:Return_L66_C2", "label": "return", "type": "return", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L62_C0", "vector": [13, 1, 0.6735, 0.0102, 1, 0.79, 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_1277:FunctionDef_L68_C0", "label": "print_top", "type": "function", "loc": [68, 72], "level": 0, "parent": null, "vector": [2, 0, 0.7143, 0.051, 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=sorted(readfile(filename), key=lambda tuples:tuples[-1:])\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_1277:Assign_L69_C2", "label": "arr = sorted()", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L68_C0", "vector": [14, 1, 0.7041, 0.0102, 1, 0.38, 0.0, 395, 3, 2, 0, 0, 134, 10, 2], "semantic": {"name": "arr", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " arr=sorted(readfile(filename), key=lambda tuples:tuples[-1:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1277:For_L70_C2", "label": "for i", "type": "for", "loc": [70, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L68_C0", "vector": [6, 1, 0.7194, 0.0204, 1, 0.38, 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_1277:Expr_L71_C4", "label": "print()", "type": "expression", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:For_L70_C2", "vector": [8, 2, 0.7245, 0.0102, 2, 0.34, 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_1277:Return_L72_C2", "label": "return", "type": "return", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L68_C0", "vector": [13, 1, 0.7347, 0.0102, 1, 0.38, 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_1277: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_1277:If_L83_C2", "label": "if", "type": "if", "loc": [83, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L82_C0", "vector": [4, 1, 0.8571, 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) != 3:\n print('usage: ./wordcount.py {--count | --topcount} file')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1277:Expr_L84_C4", "label": "print()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L83_C2", "vector": [8, 2, 0.8571, 0.0102, 2, 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('usage: ./wordcount.py {--count | --topcount} file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1277:Expr_L85_C4", "label": "exit()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L83_C2", "vector": [8, 2, 0.8673, 0.0102, 2, 0.23, 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_1277:Assign_L87_C2", "label": "option =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L82_C0", "vector": [14, 1, 0.8878, 0.0102, 1, 0.5, 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_1277:Assign_L88_C2", "label": "filename =", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L82_C0", "vector": [14, 1, 0.898, 0.0102, 1, 0.5, 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_1277:If_L89_C2", "label": "if", "type": "if", "loc": [89, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L82_C0", "vector": [4, 1, 0.9388, 0.0714, 1, 0.5, 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_1277:Expr_L90_C4", "label": "print_words()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L89_C2", "vector": [8, 2, 0.9184, 0.0102, 2, 0.68, 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_1277:If_L91_C2", "label": "if", "type": "if", "loc": [91, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L89_C2", "vector": [4, 2, 0.949, 0.051, 2, 0.68, 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_1277:Expr_L92_C4", "label": "print_top()", "type": "expression", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L91_C2", "vector": [8, 3, 0.9388, 0.0102, 3, 0.71, 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_1277:Expr_L94_C4", "label": "print()", "type": "expression", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L91_C2", "vector": [8, 3, 0.9592, 0.0102, 3, 0.71, 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_1277:Expr_L95_C4", "label": "exit()", "type": "expression", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L91_C2", "vector": [8, 3, 0.9694, 0.0102, 3, 0.71, 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_1277: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_1277:Expr_L98_C2", "label": "main()", "type": "expression", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L97_C0", "vector": [8, 1, 1.0, 0.0102, 1, 0.07, 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_1277:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Assign_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Assign_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Assign_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Assign_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Assign_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Assign_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:For_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:For_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Expr_L55_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Expr_L56_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Assign_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:For_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:For_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Expr_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Return_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Assign_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:For_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:For_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Expr_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Return_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Assign_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:For_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:For_L70_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Expr_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Return_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Assign_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L89_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1277:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1277:If_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1277: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+++
size=len(nums);
if size == 0:
return nums;
i=0;
j=0;
count=0;
size_lst=0;
lst=[];
lst.append(nums[0]);
while i< size:
size_lst=len(lst);
while j < size_lst:
if nums[i] != lst[j]:
count=count+1;
j=j+1;
if count == size_lst:
lst.append(nums[i]);
count=0;
j=0;
size_lst=0;
i=i+1;
return lst;
# 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+++
list1=list1+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_1283 | 42 | 85 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "label": "remove_adjacent", "type": "function", "loc": [15, 38], "level": 0, "parent": null, "vector": [2, 0, 0.3118, 0.2824, 0, 0.66, 0.0, 855, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "remove_adjacent", "arg_names": ["nums"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def remove_adjacent(nums):\n # +++your code here+++\n\tsize=len(nums);\n\tif size == 0:\n\t\treturn nums;\n\ti=0;\n\tj=0;\n\tcount=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L17_C1", "label": "size = len()", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "vector": [14, 1, 0.2, 0.0118, 1, 0.68, 0.0, 714, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "size", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": "\tsize=len(nums);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:If_L18_C1", "label": "if", "type": "if", "loc": [18, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "vector": [4, 1, 0.2176, 0.0235, 1, 0.68, 0.1111, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif size == 0:\n\t\treturn nums;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Return_L19_C2", "label": "return", "type": "return", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:If_L18_C1", "vector": [13, 2, 0.2235, 0.0118, 2, 0.0, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn nums;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L20_C1", "label": "i =", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "vector": [14, 1, 0.2353, 0.0118, 1, 0.68, 0.2222, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ti=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L21_C1", "label": "j =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "vector": [14, 1, 0.2471, 0.0118, 1, 0.68, 0.3333, 100, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tj=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L22_C1", "label": "count =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "vector": [14, 1, 0.2588, 0.0118, 1, 0.68, 0.4444, 778, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tcount=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L23_C1", "label": "size_lst =", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "vector": [14, 1, 0.2706, 0.0118, 1, 0.68, 0.5556, 281, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "size_lst", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tsize_lst=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L24_C1", "label": "lst =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "vector": [14, 1, 0.2824, 0.0118, 1, 0.68, 0.6667, 564, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "lst", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tlst=[];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Expr_L25_C1", "label": "append()", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "vector": [8, 1, 0.2941, 0.0118, 1, 0.68, 0.7778, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\tlst.append(nums[0]);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L26_C1", "label": "while", "type": "while", "loc": [26, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "vector": [5, 1, 0.3706, 0.1412, 1, 0.68, 0.8889, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\twhile i< size:\n\t\tsize_lst=len(lst);\n\t\twhile j < size_lst:\n\t\t\tif nums[i] != lst[j]:\n\t\t\t\tcount=count+1;\n\t\t\tj=j+1;\n\t\tif count == size_lst:\n\t\t\tlst.append(nums[i]);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L27_C2", "label": "size_lst = len()", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L26_C1", "vector": [14, 2, 0.3176, 0.0118, 2, 0.73, 0.0, 281, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "size_lst", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": "\t\tsize_lst=len(lst);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L28_C2", "label": "while", "type": "while", "loc": [28, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L26_C1", "vector": [5, 2, 0.3471, 0.0471, 2, 0.73, 0.1667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\twhile j < size_lst:\n\t\t\tif nums[i] != lst[j]:\n\t\t\t\tcount=count+1;\n\t\t\tj=j+1;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:If_L29_C3", "label": "if", "type": "if", "loc": [29, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L28_C2", "vector": [4, 3, 0.3471, 0.0235, 3, 0.18, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif nums[i] != lst[j]:\n\t\t\t\tcount=count+1;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L30_C4", "label": "count =", "type": "assigned_variable", "loc": [30, 30], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:If_L29_C3", "vector": [14, 4, 0.3529, 0.0118, 4, 0.54, 0.0, 778, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tcount=count+1;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L31_C3", "label": "j =", "type": "assigned_variable", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L28_C2", "vector": [14, 3, 0.3647, 0.0118, 3, 0.18, 1.0, 100, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tj=j+1;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:If_L32_C2", "label": "if", "type": "if", "loc": [32, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L26_C1", "vector": [4, 2, 0.3824, 0.0235, 2, 0.73, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif count == size_lst:\n\t\t\tlst.append(nums[i]);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Expr_L33_C3", "label": "append()", "type": "expression", "loc": [33, 33], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:If_L32_C2", "vector": [8, 3, 0.3882, 0.0118, 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": "\t\t\tlst.append(nums[i]);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L34_C2", "label": "count =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L26_C1", "vector": [14, 2, 0.4, 0.0118, 2, 0.73, 0.5, 778, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tcount=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L35_C2", "label": "j =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L26_C1", "vector": [14, 2, 0.4118, 0.0118, 2, 0.73, 0.6667, 100, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tj=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L36_C2", "label": "size_lst =", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L26_C1", "vector": [14, 2, 0.4235, 0.0118, 2, 0.73, 0.8333, 281, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "size_lst", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tsize_lst=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L37_C2", "label": "i =", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L26_C1", "vector": [14, 2, 0.4353, 0.0118, 2, 0.73, 1.0, 826, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ti=i+1;\t\t\t\t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Return_L38_C1", "label": "return", "type": "return", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "vector": [13, 1, 0.4471, 0.0118, 1, 0.68, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn lst; "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L44_C0", "label": "linear_merge", "type": "function", "loc": [44, 48], "level": 0, "parent": null, "vector": [2, 0, 0.5412, 0.0588, 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\tlist1=list1+list2;\n\tlist1.sort();\n\treturn list1;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L46_C1", "label": "list1 =", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L44_C0", "vector": [14, 1, 0.5412, 0.0118, 1, 0.24, 0.0, 150, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "list1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tlist1=list1+list2;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Expr_L47_C1", "label": "sort()", "type": "expression", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L44_C0", "vector": [8, 1, 0.5529, 0.0118, 1, 0.24, 0.5, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": "\tlist1.sort();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Return_L48_C1", "label": "return", "type": "return", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L44_C0", "vector": [13, 1, 0.5647, 0.0118, 1, 0.24, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn list1;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L61_C0", "label": "test", "type": "function", "loc": [61, 66], "level": 0, "parent": null, "vector": [2, 0, 0.7471, 0.0706, 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_1283:If_L62_C2", "label": "if", "type": "if", "loc": [62, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L61_C0", "vector": [4, 1, 0.7471, 0.0471, 1, 0.46, 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_1283:Assign_L63_C4", "label": "prefix =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:If_L62_C2", "vector": [14, 2, 0.7412, 0.0118, 2, 0.96, 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_1283:Assign_L65_C4", "label": "prefix =", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:If_L62_C2", "vector": [14, 2, 0.7647, 0.0118, 2, 0.96, 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_1283:Expr_L66_C2", "label": "print()", "type": "expression", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L61_C0", "vector": [8, 1, 0.7765, 0.0118, 1, 0.46, 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_1283:FunctionDef_L70_C0", "label": "main", "type": "function", "loc": [70, 81], "level": 0, "parent": null, "vector": [2, 0, 0.8882, 0.1412, 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_1283:Expr_L71_C2", "label": "print()", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L70_C0", "vector": [8, 1, 0.8353, 0.0118, 1, 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('remove_adjacent')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1283:Expr_L72_C2", "label": "test()", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L70_C0", "vector": [8, 1, 0.8471, 0.0118, 1, 0.12, 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_1283:Expr_L73_C2", "label": "test()", "type": "expression", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L70_C0", "vector": [8, 1, 0.8588, 0.0118, 1, 0.12, 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_1283:Expr_L74_C2", "label": "test()", "type": "expression", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L70_C0", "vector": [8, 1, 0.8706, 0.0118, 1, 0.12, 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_1283:Expr_L76_C2", "label": "test()", "type": "expression", "loc": [76, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L70_C0", "vector": [8, 1, 0.9, 0.0235, 1, 0.12, 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_1283:Expr_L78_C2", "label": "test()", "type": "expression", "loc": [78, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L70_C0", "vector": [8, 1, 0.9235, 0.0235, 1, 0.12, 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_1283:Expr_L80_C2", "label": "test()", "type": "expression", "loc": [80, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L70_C0", "vector": [8, 1, 0.9471, 0.0235, 1, 0.12, 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_1283:If_L84_C0", "label": "if", "type": "if", "loc": [84, 85], "level": 0, "parent": null, "vector": [4, 0, 0.9941, 0.0235, 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_1283:Expr_L85_C2", "label": "main()", "type": "expression", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1283:If_L84_C0", "vector": [8, 1, 1.0, 0.0118, 1, 0.25, 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_1283:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L17_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:If_L18_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:If_L18_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Return_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L20_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L21_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L22_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L23_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L24_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Expr_L25_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L26_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L26_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L26_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L28_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:If_L29_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:If_L29_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L28_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L31_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L26_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:If_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:If_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Expr_L33_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L26_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L26_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L26_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:While_L26_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Return_L38_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L46_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Expr_L47_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Return_L48_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:If_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Expr_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Expr_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Expr_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Expr_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Expr_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Expr_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Expr_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Expr_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1283:If_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1283:Expr_L85_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+++
size=len(nums);
if size == 0:
return nums;
i=0;
j=0;
count=0;
size_lst=0;
lst=[];
lst.append(nums[0]);
while i< size:
size_lst=len(lst);
while j < size_lst:
if nums[i] != lst[j]:
count=count+1;
j=j+1;
if count == size_lst:
lst.append(nums[i]);
count=0;
j=0;
size_lst=0;
i=i+1;
return lst;
# 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+++
list1=list1+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_1286 | 42 | 85 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "label": "remove_adjacent", "type": "function", "loc": [15, 38], "level": 0, "parent": null, "vector": [2, 0, 0.3118, 0.2824, 0, 0.66, 0.0, 855, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "remove_adjacent", "arg_names": ["nums"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def remove_adjacent(nums):\n # +++your code here+++\n\tsize=len(nums);\n\tif size == 0:\n\t\treturn nums;\n\ti=0;\n\tj=0;\n\tcount=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L17_C1", "label": "size = len()", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "vector": [14, 1, 0.2, 0.0118, 1, 0.29, 0.0, 714, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "size", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": "\tsize=len(nums);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:If_L18_C1", "label": "if", "type": "if", "loc": [18, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "vector": [4, 1, 0.2176, 0.0235, 1, 0.29, 0.1111, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif size == 0:\n\t\treturn nums;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Return_L19_C2", "label": "return", "type": "return", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:If_L18_C1", "vector": [13, 2, 0.2235, 0.0118, 2, 0.37, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn nums;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L20_C1", "label": "i =", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "vector": [14, 1, 0.2353, 0.0118, 1, 0.29, 0.2222, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ti=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L21_C1", "label": "j =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "vector": [14, 1, 0.2471, 0.0118, 1, 0.29, 0.3333, 100, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tj=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L22_C1", "label": "count =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "vector": [14, 1, 0.2588, 0.0118, 1, 0.29, 0.4444, 778, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tcount=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L23_C1", "label": "size_lst =", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "vector": [14, 1, 0.2706, 0.0118, 1, 0.29, 0.5556, 281, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "size_lst", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tsize_lst=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L24_C1", "label": "lst =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "vector": [14, 1, 0.2824, 0.0118, 1, 0.29, 0.6667, 564, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "lst", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tlst=[];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Expr_L25_C1", "label": "append()", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "vector": [8, 1, 0.2941, 0.0118, 1, 0.29, 0.7778, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\tlst.append(nums[0]);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L26_C1", "label": "while", "type": "while", "loc": [26, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "vector": [5, 1, 0.3706, 0.1412, 1, 0.29, 0.8889, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\twhile i< size:\n\t\tsize_lst=len(lst);\n\t\twhile j < size_lst:\n\t\t\tif nums[i] != lst[j]:\n\t\t\t\tcount=count+1;\n\t\t\tj=j+1;\n\t\tif count == size_lst:\n\t\t\tlst.append(nums[i]);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L27_C2", "label": "size_lst = len()", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L26_C1", "vector": [14, 2, 0.3176, 0.0118, 2, 0.41, 0.0, 281, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "size_lst", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": "\t\tsize_lst=len(lst);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L28_C2", "label": "while", "type": "while", "loc": [28, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L26_C1", "vector": [5, 2, 0.3471, 0.0471, 2, 0.41, 0.1667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\twhile j < size_lst:\n\t\t\tif nums[i] != lst[j]:\n\t\t\t\tcount=count+1;\n\t\t\tj=j+1;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:If_L29_C3", "label": "if", "type": "if", "loc": [29, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L28_C2", "vector": [4, 3, 0.3471, 0.0235, 3, 0.1, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif nums[i] != lst[j]:\n\t\t\t\tcount=count+1;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L30_C4", "label": "count =", "type": "assigned_variable", "loc": [30, 30], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:If_L29_C3", "vector": [14, 4, 0.3529, 0.0118, 4, 0.58, 0.0, 778, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tcount=count+1;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L31_C3", "label": "j =", "type": "assigned_variable", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L28_C2", "vector": [14, 3, 0.3647, 0.0118, 3, 0.1, 1.0, 100, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tj=j+1;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:If_L32_C2", "label": "if", "type": "if", "loc": [32, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L26_C1", "vector": [4, 2, 0.3824, 0.0235, 2, 0.41, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif count == size_lst:\n\t\t\tlst.append(nums[i]);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Expr_L33_C3", "label": "append()", "type": "expression", "loc": [33, 33], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:If_L32_C2", "vector": [8, 3, 0.3882, 0.0118, 3, 0.13, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\t\t\tlst.append(nums[i]);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L34_C2", "label": "count =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L26_C1", "vector": [14, 2, 0.4, 0.0118, 2, 0.41, 0.5, 778, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tcount=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L35_C2", "label": "j =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L26_C1", "vector": [14, 2, 0.4118, 0.0118, 2, 0.41, 0.6667, 100, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tj=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L36_C2", "label": "size_lst =", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L26_C1", "vector": [14, 2, 0.4235, 0.0118, 2, 0.41, 0.8333, 281, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "size_lst", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tsize_lst=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L37_C2", "label": "i =", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L26_C1", "vector": [14, 2, 0.4353, 0.0118, 2, 0.41, 1.0, 826, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ti=i+1;\t\t\t\t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Return_L38_C1", "label": "return", "type": "return", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "vector": [13, 1, 0.4471, 0.0118, 1, 0.29, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn lst; "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L44_C0", "label": "linear_merge", "type": "function", "loc": [44, 48], "level": 0, "parent": null, "vector": [2, 0, 0.5412, 0.0588, 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\tlist1=list1+list2;\n\tlist1.sort();\n\treturn list1;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L46_C1", "label": "list1 =", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L44_C0", "vector": [14, 1, 0.5412, 0.0118, 1, 0.38, 0.0, 150, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "list1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tlist1=list1+list2;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Expr_L47_C1", "label": "sort()", "type": "expression", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L44_C0", "vector": [8, 1, 0.5529, 0.0118, 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": "\tlist1.sort();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:Return_L48_C1", "label": "return", "type": "return", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L44_C0", "vector": [13, 1, 0.5647, 0.0118, 1, 0.38, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn list1;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L61_C0", "label": "test", "type": "function", "loc": [61, 66], "level": 0, "parent": null, "vector": [2, 0, 0.7471, 0.0706, 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_1286:If_L62_C2", "label": "if", "type": "if", "loc": [62, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L61_C0", "vector": [4, 1, 0.7471, 0.0471, 1, 0.31, 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_1286:Assign_L63_C4", "label": "prefix =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:If_L62_C2", "vector": [14, 2, 0.7412, 0.0118, 2, 0.44, 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_1286:Assign_L65_C4", "label": "prefix =", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:If_L62_C2", "vector": [14, 2, 0.7647, 0.0118, 2, 0.44, 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_1286:Expr_L66_C2", "label": "print()", "type": "expression", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L61_C0", "vector": [8, 1, 0.7765, 0.0118, 1, 0.31, 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_1286:FunctionDef_L70_C0", "label": "main", "type": "function", "loc": [70, 81], "level": 0, "parent": null, "vector": [2, 0, 0.8882, 0.1412, 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_1286:Expr_L71_C2", "label": "print()", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L70_C0", "vector": [8, 1, 0.8353, 0.0118, 1, 0.99, 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_1286:Expr_L72_C2", "label": "test()", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L70_C0", "vector": [8, 1, 0.8471, 0.0118, 1, 0.99, 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_1286:Expr_L73_C2", "label": "test()", "type": "expression", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L70_C0", "vector": [8, 1, 0.8588, 0.0118, 1, 0.99, 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_1286:Expr_L74_C2", "label": "test()", "type": "expression", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L70_C0", "vector": [8, 1, 0.8706, 0.0118, 1, 0.99, 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_1286:Expr_L76_C2", "label": "test()", "type": "expression", "loc": [76, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L70_C0", "vector": [8, 1, 0.9, 0.0235, 1, 0.99, 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_1286:Expr_L78_C2", "label": "test()", "type": "expression", "loc": [78, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L70_C0", "vector": [8, 1, 0.9235, 0.0235, 1, 0.99, 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_1286:Expr_L80_C2", "label": "test()", "type": "expression", "loc": [80, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L70_C0", "vector": [8, 1, 0.9471, 0.0235, 1, 0.99, 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_1286:If_L84_C0", "label": "if", "type": "if", "loc": [84, 85], "level": 0, "parent": null, "vector": [4, 0, 0.9941, 0.0235, 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_1286:Expr_L85_C2", "label": "main()", "type": "expression", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1286:If_L84_C0", "vector": [8, 1, 1.0, 0.0118, 1, 0.91, 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_1286:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L17_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:If_L18_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:If_L18_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Return_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L20_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L21_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L22_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L23_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L24_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Expr_L25_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L26_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L26_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L26_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L28_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:If_L29_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:If_L29_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L28_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L31_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L26_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:If_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:If_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Expr_L33_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L26_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L26_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L26_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:While_L26_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Return_L38_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L46_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Expr_L47_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Return_L48_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:If_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Expr_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Expr_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Expr_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Expr_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Expr_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Expr_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Expr_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Expr_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1286:If_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1286:Expr_L85_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+++
flag = 1
new_list = []
for i in nums:
for j in new_list:
if i == j:
flag = 0
if flag == 1:
new_list.append(i)
flag=1
return new_list
# 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+++
new_list = []
while len(list1) and len(list2):
if list1[0] < list2[0]:
new_list.append(list1.pop(0))
else:
new_list.append(list2.pop(0))
new_list.extend(list2)
new_list.extend(list1)
return new_list
# 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_1303 | 35 | 80 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L15_C0", "label": "remove_adjacent", "type": "function", "loc": [15, 26], "level": 0, "parent": null, "vector": [2, 0, 0.2562, 0.15, 0, 0.66, 0.0, 855, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "remove_adjacent", "arg_names": ["nums"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def remove_adjacent(nums):\n # +++your code here+++\n flag = 1\n new_list = []\n for i in nums:\n \tfor j in new_list:\n \t\tif i == j:\n \t\t\tflag = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1303:Assign_L17_C2", "label": "flag =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L15_C0", "vector": [14, 1, 0.2125, 0.0125, 1, 0.69, 0.0, 756, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "flag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " flag = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1303:Assign_L18_C2", "label": "new_list =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L15_C0", "vector": [14, 1, 0.225, 0.0125, 1, 0.69, 0.3333, 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_1303:For_L19_C2", "label": "for i", "type": "for", "loc": [19, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L15_C0", "vector": [6, 1, 0.275, 0.0875, 1, 0.69, 0.6667, 826, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in nums:\n \tfor j in new_list:\n \t\tif i == j:\n \t\t\tflag = 0\n \tif flag == 1:\n \t\tnew_list.append(i)\n \tflag=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1303:For_L20_C3", "label": "for j", "type": "for", "loc": [20, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:For_L19_C2", "vector": [6, 2, 0.2625, 0.0375, 2, 0.25, 0.0, 100, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \tfor j in new_list:\n \t\tif i == j:\n \t\t\tflag = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L21_C4", "label": "if", "type": "if", "loc": [21, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:For_L20_C3", "vector": [4, 3, 0.2687, 0.025, 3, 0.44, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \t\tif i == j:\n \t\t\tflag = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1303:Assign_L22_C5", "label": "flag =", "type": "assigned_variable", "loc": [22, 22], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L21_C4", "vector": [14, 4, 0.275, 0.0125, 4, 0.09, 0.0, 756, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "flag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \t\t\tflag = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L23_C3", "label": "if", "type": "if", "loc": [23, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:For_L19_C2", "vector": [4, 2, 0.2938, 0.025, 2, 0.25, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \tif flag == 1:\n \t\tnew_list.append(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1303:Expr_L24_C4", "label": "append()", "type": "expression", "loc": [24, 24], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L23_C3", "vector": [8, 3, 0.3, 0.0125, 3, 0.19, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " \t\tnew_list.append(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1303:Assign_L25_C3", "label": "flag =", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:For_L19_C2", "vector": [14, 2, 0.3125, 0.0125, 2, 0.25, 1.0, 756, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "flag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \tflag=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1303:Return_L26_C2", "label": "return", "type": "return", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L15_C0", "vector": [13, 1, 0.325, 0.0125, 1, 0.69, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return new_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L33_C0", "label": "linear_merge", "type": "function", "loc": [33, 43], "level": 0, "parent": null, "vector": [2, 0, 0.475, 0.1375, 0, 0.66, 0.25, 96, 0, 2, 1, 0, 0, 0, 8], "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 new_list = []\n while len(list1) and len(list2):\n \tif list1[0] < list2[0]:\n \t\tnew_list.append(list1.pop(0))\n \telse:\n \t\tnew_list.append(list2.pop(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1303:Assign_L35_C2", "label": "new_list =", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L33_C0", "vector": [14, 1, 0.4375, 0.0125, 1, 0.77, 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_1303:While_L36_C2", "label": "while", "type": "while", "loc": [36, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L33_C0", "vector": [5, 1, 0.475, 0.0625, 1, 0.77, 0.25, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while len(list1) and len(list2):\n \tif list1[0] < list2[0]:\n \t\tnew_list.append(list1.pop(0))\n \telse:\n \t\tnew_list.append(list2.pop(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L37_C3", "label": "if", "type": "if", "loc": [37, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:While_L36_C2", "vector": [4, 2, 0.4813, 0.05, 2, 0.58, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \tif list1[0] < list2[0]:\n \t\tnew_list.append(list1.pop(0))\n \telse:\n \t\tnew_list.append(list2.pop(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1303:Expr_L38_C4", "label": "append()", "type": "expression", "loc": [38, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L37_C3", "vector": [8, 3, 0.475, 0.0125, 3, 0.2, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " \t\tnew_list.append(list1.pop(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1303:Expr_L40_C4", "label": "append()", "type": "expression", "loc": [40, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L37_C3", "vector": [8, 3, 0.5, 0.0125, 3, 0.2, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " \t\tnew_list.append(list2.pop(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1303:Expr_L41_C2", "label": "extend()", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L33_C0", "vector": [8, 1, 0.5125, 0.0125, 1, 0.77, 0.5, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " new_list.extend(list2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1303:Expr_L42_C2", "label": "extend()", "type": "expression", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L33_C0", "vector": [8, 1, 0.525, 0.0125, 1, 0.77, 0.75, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " new_list.extend(list1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1303:Return_L43_C2", "label": "return", "type": "return", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L33_C0", "vector": [13, 1, 0.5375, 0.0125, 1, 0.77, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return new_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L56_C0", "label": "test", "type": "function", "loc": [56, 61], "level": 0, "parent": null, "vector": [2, 0, 0.7312, 0.075, 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_1303:If_L57_C2", "label": "if", "type": "if", "loc": [57, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L56_C0", "vector": [4, 1, 0.7312, 0.05, 1, 0.74, 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_1303:Assign_L58_C4", "label": "prefix =", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L57_C2", "vector": [14, 2, 0.725, 0.0125, 2, 0.82, 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_1303:Assign_L60_C4", "label": "prefix =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L57_C2", "vector": [14, 2, 0.75, 0.0125, 2, 0.82, 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_1303:Expr_L61_C2", "label": "print()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L56_C0", "vector": [8, 1, 0.7625, 0.0125, 1, 0.74, 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_1303:FunctionDef_L65_C0", "label": "main", "type": "function", "loc": [65, 76], "level": 0, "parent": null, "vector": [2, 0, 0.8812, 0.15, 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_1303:Expr_L66_C2", "label": "print()", "type": "expression", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L65_C0", "vector": [8, 1, 0.825, 0.0125, 1, 0.94, 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_1303:Expr_L67_C2", "label": "test()", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L65_C0", "vector": [8, 1, 0.8375, 0.0125, 1, 0.94, 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_1303:Expr_L68_C2", "label": "test()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L65_C0", "vector": [8, 1, 0.85, 0.0125, 1, 0.94, 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_1303:Expr_L69_C2", "label": "test()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L65_C0", "vector": [8, 1, 0.8625, 0.0125, 1, 0.94, 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_1303:Expr_L71_C2", "label": "test()", "type": "expression", "loc": [71, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L65_C0", "vector": [8, 1, 0.8938, 0.025, 1, 0.94, 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_1303:Expr_L73_C2", "label": "test()", "type": "expression", "loc": [73, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L65_C0", "vector": [8, 1, 0.9187, 0.025, 1, 0.94, 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_1303:Expr_L75_C2", "label": "test()", "type": "expression", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L65_C0", "vector": [8, 1, 0.9437, 0.025, 1, 0.94, 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_1303:If_L79_C0", "label": "if", "type": "if", "loc": [79, 80], "level": 0, "parent": null, "vector": [4, 0, 0.9938, 0.025, 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_1303:Expr_L80_C2", "label": "main()", "type": "expression", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L79_C0", "vector": [8, 1, 1.0, 0.0125, 1, 0.99, 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_1303:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Assign_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:For_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:For_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:For_L20_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:For_L20_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Assign_L22_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:For_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L23_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L23_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:For_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Assign_L25_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Return_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:While_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:While_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L37_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L37_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Expr_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L37_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Expr_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Expr_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Expr_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Return_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Assign_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Expr_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Expr_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Expr_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Expr_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Expr_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Expr_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Expr_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Expr_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1303:If_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1303:Expr_L80_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
# +++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 array_of_words(filename):
f = open(filename, 'r')
array_words = {}
for line in f:
for word in line.split():
word = word.lower()
if not word in array_words:
array_words[word] = 1
else:
array_words[word] =array_words[word] + 1
f.close()
return array_words
def print_words(filename):
array_words = array_of_words(filename)
sort_by_words = sorted(array_words.keys())
for word in sort_by_words:
print word, array_words[word]
###
def print_top(filename):
array_words = array_of_words(filename)
def mykey(value):
return value[1]
words = sorted(array_words.items(), key=mykey, reverse=True)
for i in words[:20]:
print i[0], i[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_1304 | 39 | 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_1304:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 38], "level": 0, "parent": null, "vector": [8, 0, 0.25, 0.3191, 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_1304:Import_L40_C0", "label": "sys import sys", "type": "import", "loc": [40, 40], "level": 0, "parent": null, "vector": [1, 0, 0.4255, 0.0106, 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_1304:FunctionDef_L47_C0", "label": "array_of_words", "type": "function", "loc": [47, 58], "level": 0, "parent": null, "vector": [2, 0, 0.5585, 0.1277, 0, 0.66, 0.3333, 421, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "array_of_words", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def array_of_words(filename):\n \tf = open(filename, 'r')\n \tarray_words = {}\n \tfor line in f:\n \t\tfor word in line.split():\n \t\t\tword = word.lower()\n \t\t\tif not word in array_words:\n \t\t\t\tarray_words[word] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L48_C3", "label": "f = open()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L47_C0", "vector": [14, 1, 0.5106, 0.0106, 1, 0.75, 0.0, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " \tf = open(filename, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L49_C3", "label": "array_words =", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L47_C0", "vector": [14, 1, 0.5213, 0.0106, 1, 0.75, 0.25, 693, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "array_words", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \tarray_words = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:For_L50_C3", "label": "for line", "type": "for", "loc": [50, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L47_C0", "vector": [6, 1, 0.5638, 0.0745, 1, 0.75, 0.5, 373, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \tfor line in f:\n \t\tfor word in line.split():\n \t\t\tword = word.lower()\n \t\t\tif not word in array_words:\n \t\t\t\tarray_words[word] = 1\n \t\t\telse:\n \t\t\t\tarray_words[word] =array_words[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:For_L51_C4", "label": "for word", "type": "for", "loc": [51, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:For_L50_C3", "vector": [6, 2, 0.5691, 0.0638, 2, 0.53, 0.0, 107, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \t\tfor word in line.split():\n \t\t\tword = word.lower()\n \t\t\tif not word in array_words:\n \t\t\t\tarray_words[word] = 1\n \t\t\telse:\n \t\t\t\tarray_words[word] =array_words[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L52_C5", "label": "word = lower()", "type": "assigned_variable", "loc": [52, 52], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:For_L51_C4", "vector": [14, 3, 0.5532, 0.0106, 3, 0.82, 0.0, 107, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " \t\t\tword = word.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L53_C5", "label": "if", "type": "if", "loc": [53, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:For_L51_C4", "vector": [4, 3, 0.5798, 0.0426, 3, 0.82, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \t\t\tif not word in array_words:\n \t\t\t\tarray_words[word] = 1\n \t\t\telse:\n \t\t\t\tarray_words[word] =array_words[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L54_C6", "label": "assign", "type": "assigned_variable", "loc": [54, 54], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L53_C5", "vector": [14, 4, 0.5745, 0.0106, 4, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \t\t\t\tarray_words[word] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L56_C6", "label": "assign", "type": "assigned_variable", "loc": [56, 56], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L53_C5", "vector": [14, 4, 0.5957, 0.0106, 4, 0.07, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \t\t\t\tarray_words[word] =array_words[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:Expr_L57_C3", "label": "close()", "type": "expression", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L47_C0", "vector": [8, 1, 0.6064, 0.0106, 1, 0.75, 0.75, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " \tf.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:Return_L58_C3", "label": "return", "type": "return", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L47_C0", "vector": [13, 1, 0.617, 0.0106, 1, 0.75, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \treturn array_words"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L60_C0", "label": "print_words", "type": "function", "loc": [60, 64], "level": 0, "parent": null, "vector": [2, 0, 0.6596, 0.0532, 0, 0.66, 0.5, 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 \tarray_words = array_of_words(filename)\n \tsort_by_words = sorted(array_words.keys())\n \tfor word in sort_by_words:\n \t\tprint(word, array_words[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L61_C3", "label": "array_words = array_of_words()", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L60_C0", "vector": [14, 1, 0.6489, 0.0106, 1, 0.1, 0.0, 693, 3, 1, 0, 0, 421, 10, 1], "semantic": {"name": "array_words", "arg_names": [], "import_names": [], "rhs_call_name": "array_of_words", "annotation": ""}, "snippet": " \tarray_words = array_of_words(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L62_C3", "label": "sort_by_words = sorted()", "type": "assigned_variable", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L60_C0", "vector": [14, 1, 0.6596, 0.0106, 1, 0.1, 0.5, 971, 3, 1, 0, 0, 134, 10, 2], "semantic": {"name": "sort_by_words", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " \tsort_by_words = sorted(array_words.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:For_L63_C3", "label": "for word", "type": "for", "loc": [63, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L60_C0", "vector": [6, 1, 0.6755, 0.0213, 1, 0.1, 1.0, 107, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \tfor word in sort_by_words:\n \t\tprint(word, array_words[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:Expr_L64_C4", "label": "print()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:For_L63_C3", "vector": [8, 2, 0.6809, 0.0106, 2, 0.63, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " \t\tprint(word, array_words[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L67_C0", "label": "print_top", "type": "function", "loc": [67, 73], "level": 0, "parent": null, "vector": [2, 0, 0.7447, 0.0745, 0, 0.66, 0.6667, 148, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "print_top", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_top(filename):\n \tarray_words = array_of_words(filename)\n \tdef mykey(value):\n \t\treturn value[1]\n \twords = sorted(array_words.items(), key=mykey, reverse=True)\n \tfor i in words[:20]:\n \t\tprint(i[0], i[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L68_C3", "label": "array_words = array_of_words()", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L67_C0", "vector": [14, 1, 0.7234, 0.0106, 1, 0.86, 0.0, 693, 3, 1, 0, 0, 421, 10, 1], "semantic": {"name": "array_words", "arg_names": [], "import_names": [], "rhs_call_name": "array_of_words", "annotation": ""}, "snippet": " \tarray_words = array_of_words(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L69_C3", "label": "mykey", "type": "function", "loc": [69, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L67_C0", "vector": [2, 1, 0.7394, 0.0213, 1, 0.86, 0.3333, 965, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "mykey", "arg_names": ["value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \tdef mykey(value):\n \t\treturn value[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:Return_L70_C4", "label": "return", "type": "return", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L69_C3", "vector": [13, 2, 0.7447, 0.0106, 2, 0.92, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \t\treturn value[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L71_C3", "label": "words = sorted()", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L67_C0", "vector": [14, 1, 0.7553, 0.0106, 1, 0.86, 0.6667, 376, 3, 3, 0, 0, 134, 10, 2], "semantic": {"name": "words", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " \twords = sorted(array_words.items(), key=mykey, reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:For_L72_C3", "label": "for i", "type": "for", "loc": [72, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L67_C0", "vector": [6, 1, 0.7713, 0.0213, 1, 0.86, 1.0, 826, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \tfor i in words[:20]:\n \t\tprint(i[0], i[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:Expr_L73_C4", "label": "print()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:For_L72_C3", "vector": [8, 2, 0.7766, 0.0106, 2, 0.38, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " \t\tprint(i[0], i[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L78_C0", "label": "main", "type": "function", "loc": [78, 91], "level": 0, "parent": null, "vector": [2, 0, 0.8989, 0.1489, 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_1304:If_L79_C2", "label": "if", "type": "if", "loc": [79, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L78_C0", "vector": [4, 1, 0.8511, 0.0319, 1, 0.38, 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_1304:Expr_L80_C4", "label": "print()", "type": "expression", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L79_C2", "vector": [8, 2, 0.8511, 0.0106, 2, 0.98, 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_1304:Expr_L81_C4", "label": "exit()", "type": "expression", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L79_C2", "vector": [8, 2, 0.8617, 0.0106, 2, 0.98, 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_1304:Assign_L83_C2", "label": "option =", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L78_C0", "vector": [14, 1, 0.883, 0.0106, 1, 0.38, 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_1304:Assign_L84_C2", "label": "filename =", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L78_C0", "vector": [14, 1, 0.8936, 0.0106, 1, 0.38, 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_1304:If_L85_C2", "label": "if", "type": "if", "loc": [85, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L78_C0", "vector": [4, 1, 0.9362, 0.0745, 1, 0.38, 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_1304:Expr_L86_C4", "label": "print_words()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L85_C2", "vector": [8, 2, 0.9149, 0.0106, 2, 0.61, 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_1304:If_L87_C2", "label": "if", "type": "if", "loc": [87, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L85_C2", "vector": [4, 2, 0.9468, 0.0532, 2, 0.61, 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_1304:Expr_L88_C4", "label": "print_top()", "type": "expression", "loc": [88, 88], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L87_C2", "vector": [8, 3, 0.9362, 0.0106, 3, 0.62, 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_1304:Expr_L90_C4", "label": "print()", "type": "expression", "loc": [90, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L87_C2", "vector": [8, 3, 0.9574, 0.0106, 3, 0.62, 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_1304:Expr_L91_C4", "label": "exit()", "type": "expression", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L87_C2", "vector": [8, 3, 0.9681, 0.0106, 3, 0.62, 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_1304:If_L93_C0", "label": "if", "type": "if", "loc": [93, 94], "level": 0, "parent": null, "vector": [4, 0, 0.9947, 0.0213, 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_1304:Expr_L94_C2", "label": "main()", "type": "expression", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L93_C0", "vector": [8, 1, 1.0, 0.0106, 1, 0.02, 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_1304:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L48_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L49_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:For_L50_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:For_L50_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:For_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:For_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L52_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:For_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L53_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L53_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L54_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L53_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L56_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Expr_L57_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Return_L58_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L61_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L62_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:For_L63_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:For_L63_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L68_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L69_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L69_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Return_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L71_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:For_L72_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:For_L72_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L79_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L79_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Expr_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L79_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Expr_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Assign_L84_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L85_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L85_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Expr_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L85_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Expr_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Expr_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1304:If_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1304:Expr_L94_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+++
flag = 1
new_list = []
for i in nums:
for j in new_list:
if i == j:
flag = 0
if flag == 1:
new_list.append(i)
flag=1
return new_list
# 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+++
new_list = []
while len(list1) and len(list2):
if list1[0] < list2[0]:
new_list.append(list1.pop(0))
else:
new_list.append(list2.pop(0))
new_list.extend(list2)
new_list.extend(list1)
return new_list
# 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_1306 | 35 | 80 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L15_C0", "label": "remove_adjacent", "type": "function", "loc": [15, 26], "level": 0, "parent": null, "vector": [2, 0, 0.2562, 0.15, 0, 0.66, 0.0, 855, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "remove_adjacent", "arg_names": ["nums"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def remove_adjacent(nums):\n # +++your code here+++\n flag = 1\n new_list = []\n for i in nums:\n \tfor j in new_list:\n \t\tif i == j:\n \t\t\tflag = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1306:Assign_L17_C2", "label": "flag =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L15_C0", "vector": [14, 1, 0.2125, 0.0125, 1, 0.37, 0.0, 756, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "flag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " flag = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1306:Assign_L18_C2", "label": "new_list =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L15_C0", "vector": [14, 1, 0.225, 0.0125, 1, 0.37, 0.3333, 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_1306:For_L19_C2", "label": "for i", "type": "for", "loc": [19, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L15_C0", "vector": [6, 1, 0.275, 0.0875, 1, 0.37, 0.6667, 826, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in nums:\n \tfor j in new_list:\n \t\tif i == j:\n \t\t\tflag = 0\n \tif flag == 1:\n \t\tnew_list.append(i)\n \tflag=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1306:For_L20_C3", "label": "for j", "type": "for", "loc": [20, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:For_L19_C2", "vector": [6, 2, 0.2625, 0.0375, 2, 0.67, 0.0, 100, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \tfor j in new_list:\n \t\tif i == j:\n \t\t\tflag = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L21_C4", "label": "if", "type": "if", "loc": [21, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:For_L20_C3", "vector": [4, 3, 0.2687, 0.025, 3, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \t\tif i == j:\n \t\t\tflag = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1306:Assign_L22_C5", "label": "flag =", "type": "assigned_variable", "loc": [22, 22], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L21_C4", "vector": [14, 4, 0.275, 0.0125, 4, 0.14, 0.0, 756, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "flag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \t\t\tflag = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L23_C3", "label": "if", "type": "if", "loc": [23, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:For_L19_C2", "vector": [4, 2, 0.2938, 0.025, 2, 0.67, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \tif flag == 1:\n \t\tnew_list.append(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1306:Expr_L24_C4", "label": "append()", "type": "expression", "loc": [24, 24], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L23_C3", "vector": [8, 3, 0.3, 0.0125, 3, 0.19, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " \t\tnew_list.append(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1306:Assign_L25_C3", "label": "flag =", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:For_L19_C2", "vector": [14, 2, 0.3125, 0.0125, 2, 0.67, 1.0, 756, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "flag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \tflag=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1306:Return_L26_C2", "label": "return", "type": "return", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L15_C0", "vector": [13, 1, 0.325, 0.0125, 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 new_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L33_C0", "label": "linear_merge", "type": "function", "loc": [33, 43], "level": 0, "parent": null, "vector": [2, 0, 0.475, 0.1375, 0, 0.66, 0.25, 96, 0, 2, 1, 0, 0, 0, 8], "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 new_list = []\n while len(list1) and len(list2):\n \tif list1[0] < list2[0]:\n \t\tnew_list.append(list1.pop(0))\n \telse:\n \t\tnew_list.append(list2.pop(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1306:Assign_L35_C2", "label": "new_list =", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L33_C0", "vector": [14, 1, 0.4375, 0.0125, 1, 0.41, 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_1306:While_L36_C2", "label": "while", "type": "while", "loc": [36, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L33_C0", "vector": [5, 1, 0.475, 0.0625, 1, 0.41, 0.25, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while len(list1) and len(list2):\n \tif list1[0] < list2[0]:\n \t\tnew_list.append(list1.pop(0))\n \telse:\n \t\tnew_list.append(list2.pop(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L37_C3", "label": "if", "type": "if", "loc": [37, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:While_L36_C2", "vector": [4, 2, 0.4813, 0.05, 2, 0.18, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \tif list1[0] < list2[0]:\n \t\tnew_list.append(list1.pop(0))\n \telse:\n \t\tnew_list.append(list2.pop(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1306:Expr_L38_C4", "label": "append()", "type": "expression", "loc": [38, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L37_C3", "vector": [8, 3, 0.475, 0.0125, 3, 0.32, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " \t\tnew_list.append(list1.pop(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1306:Expr_L40_C4", "label": "append()", "type": "expression", "loc": [40, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L37_C3", "vector": [8, 3, 0.5, 0.0125, 3, 0.32, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " \t\tnew_list.append(list2.pop(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1306:Expr_L41_C2", "label": "extend()", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L33_C0", "vector": [8, 1, 0.5125, 0.0125, 1, 0.41, 0.5, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " new_list.extend(list2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1306:Expr_L42_C2", "label": "extend()", "type": "expression", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L33_C0", "vector": [8, 1, 0.525, 0.0125, 1, 0.41, 0.75, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " new_list.extend(list1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1306:Return_L43_C2", "label": "return", "type": "return", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L33_C0", "vector": [13, 1, 0.5375, 0.0125, 1, 0.41, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return new_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L56_C0", "label": "test", "type": "function", "loc": [56, 61], "level": 0, "parent": null, "vector": [2, 0, 0.7312, 0.075, 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_1306:If_L57_C2", "label": "if", "type": "if", "loc": [57, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L56_C0", "vector": [4, 1, 0.7312, 0.05, 1, 0.77, 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_1306:Assign_L58_C4", "label": "prefix =", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L57_C2", "vector": [14, 2, 0.725, 0.0125, 2, 0.93, 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_1306:Assign_L60_C4", "label": "prefix =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L57_C2", "vector": [14, 2, 0.75, 0.0125, 2, 0.93, 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_1306:Expr_L61_C2", "label": "print()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L56_C0", "vector": [8, 1, 0.7625, 0.0125, 1, 0.77, 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_1306:FunctionDef_L65_C0", "label": "main", "type": "function", "loc": [65, 76], "level": 0, "parent": null, "vector": [2, 0, 0.8812, 0.15, 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_1306:Expr_L66_C2", "label": "print()", "type": "expression", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L65_C0", "vector": [8, 1, 0.825, 0.0125, 1, 0.3, 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_1306:Expr_L67_C2", "label": "test()", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L65_C0", "vector": [8, 1, 0.8375, 0.0125, 1, 0.3, 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_1306:Expr_L68_C2", "label": "test()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L65_C0", "vector": [8, 1, 0.85, 0.0125, 1, 0.3, 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_1306:Expr_L69_C2", "label": "test()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L65_C0", "vector": [8, 1, 0.8625, 0.0125, 1, 0.3, 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_1306:Expr_L71_C2", "label": "test()", "type": "expression", "loc": [71, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L65_C0", "vector": [8, 1, 0.8938, 0.025, 1, 0.3, 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_1306:Expr_L73_C2", "label": "test()", "type": "expression", "loc": [73, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L65_C0", "vector": [8, 1, 0.9187, 0.025, 1, 0.3, 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_1306:Expr_L75_C2", "label": "test()", "type": "expression", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L65_C0", "vector": [8, 1, 0.9437, 0.025, 1, 0.3, 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_1306:If_L79_C0", "label": "if", "type": "if", "loc": [79, 80], "level": 0, "parent": null, "vector": [4, 0, 0.9938, 0.025, 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_1306:Expr_L80_C2", "label": "main()", "type": "expression", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L79_C0", "vector": [8, 1, 1.0, 0.0125, 1, 0.97, 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_1306:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Assign_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:For_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:For_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:For_L20_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:For_L20_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Assign_L22_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:For_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L23_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L23_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:For_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Assign_L25_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Return_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:While_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:While_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L37_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L37_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Expr_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L37_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Expr_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Expr_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Expr_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Return_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Assign_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Expr_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Expr_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Expr_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Expr_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Expr_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Expr_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Expr_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Expr_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1306:If_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1306:Expr_L80_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
# +++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 array_of_words(filename):
f = open(filename, 'r')
array_words = {}
for line in f:
for word in line.split():
word = word.lower()
if not word in array_words:
array_words[word] = 1
else:
array_words[word] =array_words[word] + 1
f.close()
return array_words
def print_words(filename):
array_words = array_of_words(filename)
sort_by_words = sorted(array_words.keys())
for word in sort_by_words:
print word, array_words[word]
###
def print_top(filename):
array_words = array_of_words(filename)
def mykey(value):
return value[1]
words = sorted(array_words.items(), key=mykey, reverse=True)
for i in words[:20]:
print i[0], i[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_1307 | 39 | 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_1307:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 38], "level": 0, "parent": null, "vector": [8, 0, 0.25, 0.3191, 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_1307:Import_L40_C0", "label": "sys import sys", "type": "import", "loc": [40, 40], "level": 0, "parent": null, "vector": [1, 0, 0.4255, 0.0106, 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_1307:FunctionDef_L47_C0", "label": "array_of_words", "type": "function", "loc": [47, 58], "level": 0, "parent": null, "vector": [2, 0, 0.5585, 0.1277, 0, 0.66, 0.3333, 421, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "array_of_words", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def array_of_words(filename):\n \tf = open(filename, 'r')\n \tarray_words = {}\n \tfor line in f:\n \t\tfor word in line.split():\n \t\t\tword = word.lower()\n \t\t\tif not word in array_words:\n \t\t\t\tarray_words[word] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L48_C3", "label": "f = open()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L47_C0", "vector": [14, 1, 0.5106, 0.0106, 1, 0.59, 0.0, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " \tf = open(filename, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L49_C3", "label": "array_words =", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L47_C0", "vector": [14, 1, 0.5213, 0.0106, 1, 0.59, 0.25, 693, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "array_words", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \tarray_words = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:For_L50_C3", "label": "for line", "type": "for", "loc": [50, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L47_C0", "vector": [6, 1, 0.5638, 0.0745, 1, 0.59, 0.5, 373, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \tfor line in f:\n \t\tfor word in line.split():\n \t\t\tword = word.lower()\n \t\t\tif not word in array_words:\n \t\t\t\tarray_words[word] = 1\n \t\t\telse:\n \t\t\t\tarray_words[word] =array_words[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:For_L51_C4", "label": "for word", "type": "for", "loc": [51, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:For_L50_C3", "vector": [6, 2, 0.5691, 0.0638, 2, 0.71, 0.0, 107, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \t\tfor word in line.split():\n \t\t\tword = word.lower()\n \t\t\tif not word in array_words:\n \t\t\t\tarray_words[word] = 1\n \t\t\telse:\n \t\t\t\tarray_words[word] =array_words[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L52_C5", "label": "word = lower()", "type": "assigned_variable", "loc": [52, 52], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:For_L51_C4", "vector": [14, 3, 0.5532, 0.0106, 3, 0.09, 0.0, 107, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " \t\t\tword = word.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L53_C5", "label": "if", "type": "if", "loc": [53, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:For_L51_C4", "vector": [4, 3, 0.5798, 0.0426, 3, 0.09, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \t\t\tif not word in array_words:\n \t\t\t\tarray_words[word] = 1\n \t\t\telse:\n \t\t\t\tarray_words[word] =array_words[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L54_C6", "label": "assign", "type": "assigned_variable", "loc": [54, 54], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L53_C5", "vector": [14, 4, 0.5745, 0.0106, 4, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \t\t\t\tarray_words[word] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L56_C6", "label": "assign", "type": "assigned_variable", "loc": [56, 56], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L53_C5", "vector": [14, 4, 0.5957, 0.0106, 4, 0.38, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \t\t\t\tarray_words[word] =array_words[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:Expr_L57_C3", "label": "close()", "type": "expression", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L47_C0", "vector": [8, 1, 0.6064, 0.0106, 1, 0.59, 0.75, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " \tf.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:Return_L58_C3", "label": "return", "type": "return", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L47_C0", "vector": [13, 1, 0.617, 0.0106, 1, 0.59, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \treturn array_words"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L60_C0", "label": "print_words", "type": "function", "loc": [60, 64], "level": 0, "parent": null, "vector": [2, 0, 0.6596, 0.0532, 0, 0.66, 0.5, 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 \tarray_words = array_of_words(filename)\n \tsort_by_words = sorted(array_words.keys())\n \tfor word in sort_by_words:\n \t\tprint(word, array_words[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L61_C3", "label": "array_words = array_of_words()", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L60_C0", "vector": [14, 1, 0.6489, 0.0106, 1, 0.77, 0.0, 693, 3, 1, 0, 0, 421, 10, 1], "semantic": {"name": "array_words", "arg_names": [], "import_names": [], "rhs_call_name": "array_of_words", "annotation": ""}, "snippet": " \tarray_words = array_of_words(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L62_C3", "label": "sort_by_words = sorted()", "type": "assigned_variable", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L60_C0", "vector": [14, 1, 0.6596, 0.0106, 1, 0.77, 0.5, 971, 3, 1, 0, 0, 134, 10, 2], "semantic": {"name": "sort_by_words", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " \tsort_by_words = sorted(array_words.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:For_L63_C3", "label": "for word", "type": "for", "loc": [63, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L60_C0", "vector": [6, 1, 0.6755, 0.0213, 1, 0.77, 1.0, 107, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \tfor word in sort_by_words:\n \t\tprint(word, array_words[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:Expr_L64_C4", "label": "print()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:For_L63_C3", "vector": [8, 2, 0.6809, 0.0106, 2, 0.11, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " \t\tprint(word, array_words[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L67_C0", "label": "print_top", "type": "function", "loc": [67, 73], "level": 0, "parent": null, "vector": [2, 0, 0.7447, 0.0745, 0, 0.66, 0.6667, 148, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "print_top", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_top(filename):\n \tarray_words = array_of_words(filename)\n \tdef mykey(value):\n \t\treturn value[1]\n \twords = sorted(array_words.items(), key=mykey, reverse=True)\n \tfor i in words[:20]:\n \t\tprint(i[0], i[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L68_C3", "label": "array_words = array_of_words()", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L67_C0", "vector": [14, 1, 0.7234, 0.0106, 1, 0.22, 0.0, 693, 3, 1, 0, 0, 421, 10, 1], "semantic": {"name": "array_words", "arg_names": [], "import_names": [], "rhs_call_name": "array_of_words", "annotation": ""}, "snippet": " \tarray_words = array_of_words(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L69_C3", "label": "mykey", "type": "function", "loc": [69, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L67_C0", "vector": [2, 1, 0.7394, 0.0213, 1, 0.22, 0.3333, 965, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "mykey", "arg_names": ["value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \tdef mykey(value):\n \t\treturn value[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:Return_L70_C4", "label": "return", "type": "return", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L69_C3", "vector": [13, 2, 0.7447, 0.0106, 2, 0.64, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \t\treturn value[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L71_C3", "label": "words = sorted()", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L67_C0", "vector": [14, 1, 0.7553, 0.0106, 1, 0.22, 0.6667, 376, 3, 3, 0, 0, 134, 10, 2], "semantic": {"name": "words", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " \twords = sorted(array_words.items(), key=mykey, reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:For_L72_C3", "label": "for i", "type": "for", "loc": [72, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L67_C0", "vector": [6, 1, 0.7713, 0.0213, 1, 0.22, 1.0, 826, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \tfor i in words[:20]:\n \t\tprint(i[0], i[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:Expr_L73_C4", "label": "print()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:For_L72_C3", "vector": [8, 2, 0.7766, 0.0106, 2, 0.73, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " \t\tprint(i[0], i[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L78_C0", "label": "main", "type": "function", "loc": [78, 91], "level": 0, "parent": null, "vector": [2, 0, 0.8989, 0.1489, 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_1307:If_L79_C2", "label": "if", "type": "if", "loc": [79, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L78_C0", "vector": [4, 1, 0.8511, 0.0319, 1, 0.57, 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_1307:Expr_L80_C4", "label": "print()", "type": "expression", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L79_C2", "vector": [8, 2, 0.8511, 0.0106, 2, 0.34, 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_1307:Expr_L81_C4", "label": "exit()", "type": "expression", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L79_C2", "vector": [8, 2, 0.8617, 0.0106, 2, 0.34, 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_1307:Assign_L83_C2", "label": "option =", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L78_C0", "vector": [14, 1, 0.883, 0.0106, 1, 0.57, 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_1307:Assign_L84_C2", "label": "filename =", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L78_C0", "vector": [14, 1, 0.8936, 0.0106, 1, 0.57, 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_1307:If_L85_C2", "label": "if", "type": "if", "loc": [85, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L78_C0", "vector": [4, 1, 0.9362, 0.0745, 1, 0.57, 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_1307:Expr_L86_C4", "label": "print_words()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L85_C2", "vector": [8, 2, 0.9149, 0.0106, 2, 0.36, 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_1307:If_L87_C2", "label": "if", "type": "if", "loc": [87, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L85_C2", "vector": [4, 2, 0.9468, 0.0532, 2, 0.36, 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_1307:Expr_L88_C4", "label": "print_top()", "type": "expression", "loc": [88, 88], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L87_C2", "vector": [8, 3, 0.9362, 0.0106, 3, 0.87, 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_1307:Expr_L90_C4", "label": "print()", "type": "expression", "loc": [90, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L87_C2", "vector": [8, 3, 0.9574, 0.0106, 3, 0.87, 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_1307:Expr_L91_C4", "label": "exit()", "type": "expression", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L87_C2", "vector": [8, 3, 0.9681, 0.0106, 3, 0.87, 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_1307:If_L93_C0", "label": "if", "type": "if", "loc": [93, 94], "level": 0, "parent": null, "vector": [4, 0, 0.9947, 0.0213, 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_1307:Expr_L94_C2", "label": "main()", "type": "expression", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L93_C0", "vector": [8, 1, 1.0, 0.0106, 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": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L48_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L49_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:For_L50_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:For_L50_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:For_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:For_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L52_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:For_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L53_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L53_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L54_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L53_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L56_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Expr_L57_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Return_L58_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L61_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L62_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:For_L63_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:For_L63_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L68_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L69_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L69_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Return_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L71_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:For_L72_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:For_L72_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L79_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L79_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Expr_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L79_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Expr_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Assign_L84_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L85_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L85_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Expr_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L85_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Expr_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Expr_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1307:If_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1307:Expr_L94_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_1313 | 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_1313: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_1313:If_L16_C2", "label": "if", "type": "if", "loc": [16, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L15_C0", "vector": [4, 1, 0.2292, 0.0278, 1, 0.62, 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_1313:Return_L17_C4", "label": "return", "type": "return", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:If_L16_C2", "vector": [13, 2, 0.2361, 0.0139, 2, 0.45, 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_1313:Assign_L18_C2", "label": "last =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L15_C0", "vector": [14, 1, 0.25, 0.0139, 1, 0.62, 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_1313:Assign_L19_C2", "label": "mlist =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L15_C0", "vector": [14, 1, 0.2639, 0.0139, 1, 0.62, 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_1313:Expr_L20_C2", "label": "append()", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L15_C0", "vector": [8, 1, 0.2778, 0.0139, 1, 0.62, 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_1313:For_L21_C2", "label": "for i", "type": "for", "loc": [21, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L15_C0", "vector": [6, 1, 0.3125, 0.0556, 1, 0.62, 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_1313:If_L22_C4", "label": "if", "type": "if", "loc": [22, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:For_L21_C2", "vector": [4, 2, 0.3125, 0.0278, 2, 0.35, 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_1313:Expr_L23_C6", "label": "append()", "type": "expression", "loc": [23, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:If_L22_C4", "vector": [8, 3, 0.3194, 0.0139, 3, 0.39, 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_1313:Assign_L24_C4", "label": "last =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:For_L21_C2", "vector": [14, 2, 0.3333, 0.0139, 2, 0.35, 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_1313:Return_L25_C2", "label": "return", "type": "return", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L15_C0", "vector": [13, 1, 0.3472, 0.0139, 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 mlist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1313: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_1313:Expr_L33_C2", "label": "extend()", "type": "expression", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L32_C0", "vector": [8, 1, 0.4583, 0.0139, 1, 0.1, 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_1313:Expr_L34_C2", "label": "sort()", "type": "expression", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L32_C0", "vector": [8, 1, 0.4722, 0.0139, 1, 0.1, 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_1313:Return_L35_C2", "label": "return", "type": "return", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L32_C0", "vector": [13, 1, 0.4861, 0.0139, 1, 0.1, 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_1313: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_1313:If_L49_C2", "label": "if", "type": "if", "loc": [49, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L48_C0", "vector": [4, 1, 0.7014, 0.0556, 1, 0.63, 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_1313:Assign_L50_C4", "label": "prefix =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:If_L49_C2", "vector": [14, 2, 0.6944, 0.0139, 2, 0.48, 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_1313:Assign_L52_C4", "label": "prefix =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:If_L49_C2", "vector": [14, 2, 0.7222, 0.0139, 2, 0.48, 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_1313:Expr_L53_C2", "label": "print()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L48_C0", "vector": [8, 1, 0.7361, 0.0139, 1, 0.63, 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_1313: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_1313:Expr_L58_C2", "label": "print()", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L57_C0", "vector": [8, 1, 0.8056, 0.0139, 1, 0.97, 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_1313:Expr_L59_C2", "label": "test()", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L57_C0", "vector": [8, 1, 0.8194, 0.0139, 1, 0.97, 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_1313:Expr_L60_C2", "label": "test()", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L57_C0", "vector": [8, 1, 0.8333, 0.0139, 1, 0.97, 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_1313:Expr_L61_C2", "label": "test()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L57_C0", "vector": [8, 1, 0.8472, 0.0139, 1, 0.97, 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_1313:Expr_L63_C2", "label": "test()", "type": "expression", "loc": [63, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L57_C0", "vector": [8, 1, 0.8819, 0.0278, 1, 0.97, 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_1313:Expr_L65_C2", "label": "test()", "type": "expression", "loc": [65, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L57_C0", "vector": [8, 1, 0.9097, 0.0278, 1, 0.97, 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_1313:Expr_L67_C2", "label": "test()", "type": "expression", "loc": [67, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L57_C0", "vector": [8, 1, 0.9375, 0.0278, 1, 0.97, 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_1313: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_1313:Expr_L72_C2", "label": "main()", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1313:If_L71_C0", "vector": [8, 1, 1.0, 0.0139, 1, 0.79, 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_1313:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:If_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:If_L16_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Return_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Expr_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:For_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:For_L21_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:If_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Expr_L23_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:For_L21_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Return_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Expr_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Expr_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Return_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:If_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Expr_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Expr_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Expr_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Expr_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Expr_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Expr_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1313:Expr_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1313:If_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1313: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_1314 | 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_1314: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_1314: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_1314: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_1314: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_1314:Assign_L50_C2", "label": "f = open()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L49_C0", "vector": [14, 1, 0.5102, 0.0102, 1, 0.16, 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_1314:Assign_L51_C2", "label": "text = read()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L49_C0", "vector": [14, 1, 0.5204, 0.0102, 1, 0.16, 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_1314:Assign_L52_C2", "label": "text = sub()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L49_C0", "vector": [14, 1, 0.5306, 0.0102, 1, 0.16, 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_1314:Assign_L53_C2", "label": "text = lower()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L49_C0", "vector": [14, 1, 0.5408, 0.0102, 1, 0.16, 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_1314:Assign_L54_C2", "label": "words = split()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L49_C0", "vector": [14, 1, 0.551, 0.0102, 1, 0.16, 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_1314:Assign_L55_C2", "label": "wordsMap =", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L49_C0", "vector": [14, 1, 0.5612, 0.0102, 1, 0.16, 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_1314:For_L56_C2", "label": "for word", "type": "for", "loc": [56, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L49_C0", "vector": [6, 1, 0.5918, 0.051, 1, 0.16, 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_1314:If_L57_C4", "label": "if", "type": "if", "loc": [57, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:For_L56_C2", "vector": [4, 2, 0.5969, 0.0408, 2, 0.58, 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_1314:Assign_L60_C6", "label": "assign", "type": "assigned_variable", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L57_C4", "vector": [14, 3, 0.6122, 0.0102, 3, 0.81, 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_1314:Return_L62_C2", "label": "return", "type": "return", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L49_C0", "vector": [13, 1, 0.6327, 0.0102, 1, 0.16, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return wordsMap"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1314: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_1314:Assign_L67_C2", "label": "wordsMap = read_file()", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L66_C0", "vector": [14, 1, 0.6837, 0.0102, 1, 0.99, 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_1314:Assign_L68_C2", "label": "keys = sorted()", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L66_C0", "vector": [14, 1, 0.6939, 0.0102, 1, 0.99, 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_1314:For_L69_C2", "label": "for key", "type": "for", "loc": [69, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L66_C0", "vector": [6, 1, 0.7092, 0.0204, 1, 0.99, 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_1314:Expr_L70_C4", "label": "print()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314: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_1314:Return_L71_C2", "label": "return", "type": "return", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L66_C0", "vector": [13, 1, 0.7245, 0.0102, 1, 0.99, 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_1314: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_1314:Assign_L74_C2", "label": "wordsMap = read_file()", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L73_C0", "vector": [14, 1, 0.7551, 0.0102, 1, 0.72, 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_1314:For_L75_C2", "label": "for item", "type": "for", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L73_C0", "vector": [6, 1, 0.7704, 0.0204, 1, 0.72, 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_1314:Expr_L76_C4", "label": "print()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:For_L75_C2", "vector": [8, 2, 0.7755, 0.0102, 2, 0.0, 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_1314: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_1314:If_L83_C2", "label": "if", "type": "if", "loc": [83, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L82_C0", "vector": [4, 1, 0.8571, 0.0306, 1, 0.04, 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_1314:Expr_L84_C4", "label": "print()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L83_C2", "vector": [8, 2, 0.8571, 0.0102, 2, 0.44, 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_1314:Expr_L85_C4", "label": "exit()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L83_C2", "vector": [8, 2, 0.8673, 0.0102, 2, 0.44, 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_1314:Assign_L87_C2", "label": "option =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L82_C0", "vector": [14, 1, 0.8878, 0.0102, 1, 0.04, 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_1314:Assign_L88_C2", "label": "filename =", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L82_C0", "vector": [14, 1, 0.898, 0.0102, 1, 0.04, 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_1314:If_L89_C2", "label": "if", "type": "if", "loc": [89, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L82_C0", "vector": [4, 1, 0.9388, 0.0714, 1, 0.04, 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_1314:Expr_L90_C4", "label": "print_words()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L89_C2", "vector": [8, 2, 0.9184, 0.0102, 2, 0.59, 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_1314:If_L91_C2", "label": "if", "type": "if", "loc": [91, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L89_C2", "vector": [4, 2, 0.949, 0.051, 2, 0.59, 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_1314:Expr_L92_C4", "label": "print_top()", "type": "expression", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L91_C2", "vector": [8, 3, 0.9388, 0.0102, 3, 0.45, 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_1314:Expr_L94_C4", "label": "print()", "type": "expression", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L91_C2", "vector": [8, 3, 0.9592, 0.0102, 3, 0.45, 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_1314:Expr_L95_C4", "label": "exit()", "type": "expression", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L91_C2", "vector": [8, 3, 0.9694, 0.0102, 3, 0.45, 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_1314: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_1314:Expr_L98_C2", "label": "main()", "type": "expression", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L97_C0", "vector": [8, 1, 1.0, 0.0102, 1, 0.34, 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_1314:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Assign_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Assign_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Assign_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Assign_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Assign_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:For_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:For_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Assign_L60_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Return_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Assign_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Assign_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:For_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:For_L69_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Return_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Assign_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:For_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:For_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Assign_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L89_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1314:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1314:If_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1314: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_1316 | 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_1316: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_1316:If_L16_C2", "label": "if", "type": "if", "loc": [16, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L15_C0", "vector": [4, 1, 0.2292, 0.0278, 1, 0.89, 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_1316:Return_L17_C4", "label": "return", "type": "return", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:If_L16_C2", "vector": [13, 2, 0.2361, 0.0139, 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 nums"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1316:Assign_L18_C2", "label": "last =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L15_C0", "vector": [14, 1, 0.25, 0.0139, 1, 0.89, 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_1316:Assign_L19_C2", "label": "mlist =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L15_C0", "vector": [14, 1, 0.2639, 0.0139, 1, 0.89, 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_1316:Expr_L20_C2", "label": "append()", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L15_C0", "vector": [8, 1, 0.2778, 0.0139, 1, 0.89, 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_1316:For_L21_C2", "label": "for i", "type": "for", "loc": [21, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L15_C0", "vector": [6, 1, 0.3125, 0.0556, 1, 0.89, 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_1316:If_L22_C4", "label": "if", "type": "if", "loc": [22, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:For_L21_C2", "vector": [4, 2, 0.3125, 0.0278, 2, 0.23, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i!= last:\n mlist.append(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1316:Expr_L23_C6", "label": "append()", "type": "expression", "loc": [23, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:If_L22_C4", "vector": [8, 3, 0.3194, 0.0139, 3, 0.26, 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_1316:Assign_L24_C4", "label": "last =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:For_L21_C2", "vector": [14, 2, 0.3333, 0.0139, 2, 0.23, 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_1316:Return_L25_C2", "label": "return", "type": "return", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L15_C0", "vector": [13, 1, 0.3472, 0.0139, 1, 0.89, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return mlist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1316: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_1316:Expr_L33_C2", "label": "extend()", "type": "expression", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L32_C0", "vector": [8, 1, 0.4583, 0.0139, 1, 0.96, 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_1316:Expr_L34_C2", "label": "sort()", "type": "expression", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L32_C0", "vector": [8, 1, 0.4722, 0.0139, 1, 0.96, 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_1316:Return_L35_C2", "label": "return", "type": "return", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L32_C0", "vector": [13, 1, 0.4861, 0.0139, 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 list1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1316: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_1316:If_L49_C2", "label": "if", "type": "if", "loc": [49, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L48_C0", "vector": [4, 1, 0.7014, 0.0556, 1, 0.09, 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_1316:Assign_L50_C4", "label": "prefix =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:If_L49_C2", "vector": [14, 2, 0.6944, 0.0139, 2, 0.93, 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_1316:Assign_L52_C4", "label": "prefix =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:If_L49_C2", "vector": [14, 2, 0.7222, 0.0139, 2, 0.93, 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_1316:Expr_L53_C2", "label": "print()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L48_C0", "vector": [8, 1, 0.7361, 0.0139, 1, 0.09, 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_1316: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_1316:Expr_L58_C2", "label": "print()", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L57_C0", "vector": [8, 1, 0.8056, 0.0139, 1, 0.22, 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_1316:Expr_L59_C2", "label": "test()", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L57_C0", "vector": [8, 1, 0.8194, 0.0139, 1, 0.22, 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_1316:Expr_L60_C2", "label": "test()", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L57_C0", "vector": [8, 1, 0.8333, 0.0139, 1, 0.22, 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_1316:Expr_L61_C2", "label": "test()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L57_C0", "vector": [8, 1, 0.8472, 0.0139, 1, 0.22, 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_1316:Expr_L63_C2", "label": "test()", "type": "expression", "loc": [63, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L57_C0", "vector": [8, 1, 0.8819, 0.0278, 1, 0.22, 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_1316:Expr_L65_C2", "label": "test()", "type": "expression", "loc": [65, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L57_C0", "vector": [8, 1, 0.9097, 0.0278, 1, 0.22, 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_1316:Expr_L67_C2", "label": "test()", "type": "expression", "loc": [67, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L57_C0", "vector": [8, 1, 0.9375, 0.0278, 1, 0.22, 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_1316: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_1316:Expr_L72_C2", "label": "main()", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1316:If_L71_C0", "vector": [8, 1, 1.0, 0.0139, 1, 0.63, 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_1316:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:If_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:If_L16_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Return_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Expr_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:For_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:For_L21_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:If_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Expr_L23_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:For_L21_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Return_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Expr_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Expr_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Return_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:If_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Expr_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Expr_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Expr_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Expr_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Expr_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Expr_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1316:Expr_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1316:If_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1316: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_1317 | 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_1317: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_1317: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_1317: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_1317: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_1317:Assign_L50_C2", "label": "f = open()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L49_C0", "vector": [14, 1, 0.5102, 0.0102, 1, 0.0, 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_1317:Assign_L51_C2", "label": "text = read()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L49_C0", "vector": [14, 1, 0.5204, 0.0102, 1, 0.0, 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_1317:Assign_L52_C2", "label": "text = sub()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L49_C0", "vector": [14, 1, 0.5306, 0.0102, 1, 0.0, 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_1317:Assign_L53_C2", "label": "text = lower()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L49_C0", "vector": [14, 1, 0.5408, 0.0102, 1, 0.0, 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_1317:Assign_L54_C2", "label": "words = split()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L49_C0", "vector": [14, 1, 0.551, 0.0102, 1, 0.0, 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_1317:Assign_L55_C2", "label": "wordsMap =", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L49_C0", "vector": [14, 1, 0.5612, 0.0102, 1, 0.0, 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_1317:For_L56_C2", "label": "for word", "type": "for", "loc": [56, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L49_C0", "vector": [6, 1, 0.5918, 0.051, 1, 0.0, 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_1317:If_L57_C4", "label": "if", "type": "if", "loc": [57, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:For_L56_C2", "vector": [4, 2, 0.5969, 0.0408, 2, 0.79, 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_1317:Assign_L60_C6", "label": "assign", "type": "assigned_variable", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L57_C4", "vector": [14, 3, 0.6122, 0.0102, 3, 0.83, 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_1317:Return_L62_C2", "label": "return", "type": "return", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L49_C0", "vector": [13, 1, 0.6327, 0.0102, 1, 0.0, 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_1317: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_1317:Assign_L67_C2", "label": "wordsMap = read_file()", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L66_C0", "vector": [14, 1, 0.6837, 0.0102, 1, 0.65, 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_1317:Assign_L68_C2", "label": "keys = sorted()", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L66_C0", "vector": [14, 1, 0.6939, 0.0102, 1, 0.65, 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_1317:For_L69_C2", "label": "for key", "type": "for", "loc": [69, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L66_C0", "vector": [6, 1, 0.7092, 0.0204, 1, 0.65, 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_1317:Expr_L70_C4", "label": "print()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:For_L69_C2", "vector": [8, 2, 0.7143, 0.0102, 2, 0.75, 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_1317:Return_L71_C2", "label": "return", "type": "return", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L66_C0", "vector": [13, 1, 0.7245, 0.0102, 1, 0.65, 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_1317: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_1317:Assign_L74_C2", "label": "wordsMap = read_file()", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L73_C0", "vector": [14, 1, 0.7551, 0.0102, 1, 0.09, 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_1317:For_L75_C2", "label": "for item", "type": "for", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L73_C0", "vector": [6, 1, 0.7704, 0.0204, 1, 0.09, 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_1317:Expr_L76_C4", "label": "print()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:For_L75_C2", "vector": [8, 2, 0.7755, 0.0102, 2, 0.83, 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_1317: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_1317:If_L83_C2", "label": "if", "type": "if", "loc": [83, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317: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_1317:Expr_L84_C4", "label": "print()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L83_C2", "vector": [8, 2, 0.8571, 0.0102, 2, 0.68, 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_1317:Expr_L85_C4", "label": "exit()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L83_C2", "vector": [8, 2, 0.8673, 0.0102, 2, 0.68, 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_1317:Assign_L87_C2", "label": "option =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317: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_1317:Assign_L88_C2", "label": "filename =", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317: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_1317:If_L89_C2", "label": "if", "type": "if", "loc": [89, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317: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_1317:Expr_L90_C4", "label": "print_words()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L89_C2", "vector": [8, 2, 0.9184, 0.0102, 2, 0.9, 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_1317:If_L91_C2", "label": "if", "type": "if", "loc": [91, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L89_C2", "vector": [4, 2, 0.949, 0.051, 2, 0.9, 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_1317:Expr_L92_C4", "label": "print_top()", "type": "expression", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L91_C2", "vector": [8, 3, 0.9388, 0.0102, 3, 0.7, 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_1317:Expr_L94_C4", "label": "print()", "type": "expression", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L91_C2", "vector": [8, 3, 0.9592, 0.0102, 3, 0.7, 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_1317:Expr_L95_C4", "label": "exit()", "type": "expression", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L91_C2", "vector": [8, 3, 0.9694, 0.0102, 3, 0.7, 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_1317: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_1317:Expr_L98_C2", "label": "main()", "type": "expression", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L97_C0", "vector": [8, 1, 1.0, 0.0102, 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_1317:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Assign_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Assign_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Assign_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Assign_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Assign_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:For_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:For_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Assign_L60_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Return_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Assign_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Assign_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:For_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:For_L69_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Return_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Assign_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:For_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:For_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Assign_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L89_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1317:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1317:If_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1317: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
def mimic_dict(filename):
"""Returns mimic dict mapping each word to list of words which follow it."""
# +++your code here+++
return
def print_mimic(mimic_dict, word):
"""Given mimic dict and start word, prints 200 random words."""
# +++your code here+++
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_1320 | 17 | 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_1320:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 42], "level": 0, "parent": null, "vector": [8, 0, 0.3592, 0.4789, 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_1320:Import_L44_C0", "label": "random import random", "type": "import", "loc": [44, 44], "level": 0, "parent": null, "vector": [1, 0, 0.6197, 0.0141, 0, 0.66, 0.1667, 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_1320:Import_L45_C0", "label": "sys import sys", "type": "import", "loc": [45, 45], "level": 0, "parent": null, "vector": [1, 0, 0.6338, 0.0141, 0, 0.66, 0.3333, 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_1320:FunctionDef_L48_C0", "label": "mimic_dict", "type": "function", "loc": [48, 51], "level": 0, "parent": null, "vector": [2, 0, 0.6972, 0.0563, 0, 0.66, 0.5, 49, 0, 1, 0, 0, 0, 0, 0], "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 # +++your code here+++\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1320:Expr_L49_C2", "label": "expression", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1320:FunctionDef_L48_C0", "vector": [8, 1, 0.6901, 0.0141, 1, 0.48, 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_1320:Return_L51_C2", "label": "return", "type": "return", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1320:FunctionDef_L48_C0", "vector": [13, 1, 0.7183, 0.0141, 1, 0.48, 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_1320:FunctionDef_L54_C0", "label": "print_mimic", "type": "function", "loc": [54, 57], "level": 0, "parent": null, "vector": [2, 0, 0.7817, 0.0563, 0, 0.66, 0.6667, 927, 0, 2, 0, 0, 0, 0, 0], "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 return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1320:Expr_L55_C2", "label": "expression", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1320:FunctionDef_L54_C0", "vector": [8, 1, 0.7746, 0.0141, 1, 0.2, 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_1320:Return_L57_C2", "label": "return", "type": "return", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1320:FunctionDef_L54_C0", "vector": [13, 1, 0.8028, 0.0141, 1, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1320:FunctionDef_L61_C0", "label": "main", "type": "function", "loc": [61, 67], "level": 0, "parent": null, "vector": [2, 0, 0.9014, 0.0986, 0, 0.66, 0.8333, 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_1320:If_L62_C2", "label": "if", "type": "if", "loc": [62, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1320:FunctionDef_L61_C0", "vector": [4, 1, 0.8873, 0.0423, 1, 0.67, 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_1320:Expr_L63_C4", "label": "print()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1320:If_L62_C2", "vector": [8, 2, 0.8873, 0.0141, 2, 0.69, 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_1320:Expr_L64_C4", "label": "exit()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1320:If_L62_C2", "vector": [8, 2, 0.9014, 0.0141, 2, 0.69, 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_1320:Assign_L66_C2", "label": "dict = mimic_dict()", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1320:FunctionDef_L61_C0", "vector": [14, 1, 0.9296, 0.0141, 1, 0.67, 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_1320:Expr_L67_C2", "label": "print_mimic()", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1320:FunctionDef_L61_C0", "vector": [8, 1, 0.9437, 0.0141, 1, 0.67, 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_1320: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_1320:Expr_L71_C2", "label": "main()", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1320:If_L70_C0", "vector": [8, 1, 1.0, 0.0141, 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_1320:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1320:Expr_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1320:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1320:Return_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1320:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1320:Expr_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1320:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1320:Return_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1320:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1320:If_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1320:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1320:Expr_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1320:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1320:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1320:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1320:Assign_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1320:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1320:Expr_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1320:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1320:Expr_L71_C2"}] |
#!/usr/bin/python
import sys
print "hello world!"
| ajibawa-2023/Python-Code-Large/train/row_1321 | 2 | 4 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1321:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.75, 0.25, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1321:Expr_L4_C0", "label": "print()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.25, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"hello world!\")"}] | [] |
#!/usr/bin/python
# 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):
arr=[]
for n in nums:
if n not in arr:
arr.append(n)
return arr
# 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):
return sorted(list1+list2)
# 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_1325 | 23 | 49 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L7_C0", "label": "remove_adjacent", "type": "function", "loc": [7, 12], "level": 0, "parent": null, "vector": [2, 0, 0.1939, 0.1224, 0, 0.66, 0.0, 855, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "remove_adjacent", "arg_names": ["nums"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def remove_adjacent(nums):\n arr=[]\n for n in nums:\n if n not in arr:\n arr.append(n)\n return arr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1325:Assign_L8_C2", "label": "arr =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L7_C0", "vector": [14, 1, 0.1633, 0.0204, 1, 0.14, 0.0, 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_1325:For_L9_C2", "label": "for n", "type": "for", "loc": [9, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L7_C0", "vector": [6, 1, 0.2041, 0.0612, 1, 0.14, 0.5, 773, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "n", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for n in nums:\n if n not in arr:\n arr.append(n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1325:If_L10_C4", "label": "if", "type": "if", "loc": [10, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1325:For_L9_C2", "vector": [4, 2, 0.2143, 0.0408, 2, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if n not in arr:\n arr.append(n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1325:Expr_L11_C6", "label": "append()", "type": "expression", "loc": [11, 11], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1325:If_L10_C4", "vector": [8, 3, 0.2245, 0.0204, 3, 0.1, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " arr.append(n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1325:Return_L12_C2", "label": "return", "type": "return", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L7_C0", "vector": [13, 1, 0.2449, 0.0204, 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 arr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L19_C0", "label": "linear_merge", "type": "function", "loc": [19, 20], "level": 0, "parent": null, "vector": [2, 0, 0.398, 0.0408, 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 return sorted(list1+list2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1325:Return_L20_C2", "label": "return", "type": "return", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L19_C0", "vector": [13, 1, 0.4082, 0.0204, 1, 0.91, 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_1325:FunctionDef_L25_C0", "label": "test", "type": "function", "loc": [25, 30], "level": 0, "parent": null, "vector": [2, 0, 0.5612, 0.1224, 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_1325:If_L26_C2", "label": "if", "type": "if", "loc": [26, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L25_C0", "vector": [4, 1, 0.5612, 0.0816, 1, 0.27, 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_1325:Assign_L27_C4", "label": "prefix =", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1325:If_L26_C2", "vector": [14, 2, 0.551, 0.0204, 2, 0.44, 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_1325:Assign_L29_C4", "label": "prefix =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1325:If_L26_C2", "vector": [14, 2, 0.5918, 0.0204, 2, 0.44, 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_1325:Expr_L30_C2", "label": "print()", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L25_C0", "vector": [8, 1, 0.6122, 0.0204, 1, 0.27, 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_1325:FunctionDef_L34_C0", "label": "main", "type": "function", "loc": [34, 45], "level": 0, "parent": null, "vector": [2, 0, 0.8061, 0.2449, 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_1325:Expr_L35_C2", "label": "print()", "type": "expression", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L34_C0", "vector": [8, 1, 0.7143, 0.0204, 1, 0.29, 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_1325:Expr_L36_C2", "label": "test()", "type": "expression", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L34_C0", "vector": [8, 1, 0.7347, 0.0204, 1, 0.29, 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_1325:Expr_L37_C2", "label": "test()", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L34_C0", "vector": [8, 1, 0.7551, 0.0204, 1, 0.29, 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_1325:Expr_L38_C2", "label": "test()", "type": "expression", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L34_C0", "vector": [8, 1, 0.7755, 0.0204, 1, 0.29, 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_1325:Expr_L40_C2", "label": "test()", "type": "expression", "loc": [40, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L34_C0", "vector": [8, 1, 0.8265, 0.0408, 1, 0.29, 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_1325:Expr_L42_C2", "label": "test()", "type": "expression", "loc": [42, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L34_C0", "vector": [8, 1, 0.8673, 0.0408, 1, 0.29, 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_1325:Expr_L44_C2", "label": "test()", "type": "expression", "loc": [44, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L34_C0", "vector": [8, 1, 0.9082, 0.0408, 1, 0.29, 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_1325:If_L48_C0", "label": "if", "type": "if", "loc": [48, 49], "level": 0, "parent": null, "vector": [4, 0, 0.9898, 0.0408, 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_1325:Expr_L49_C2", "label": "main()", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1325:If_L48_C0", "vector": [8, 1, 1.0, 0.0204, 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_1325:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1325:Assign_L8_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1325:For_L9_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1325:For_L9_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1325:If_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1325:If_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1325:Expr_L11_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1325:Return_L12_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1325:Return_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1325:If_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1325:If_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1325:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1325:If_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1325:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1325:Expr_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1325:Expr_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1325:Expr_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1325:Expr_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1325:Expr_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1325:Expr_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1325:Expr_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1325:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1325:Expr_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1325:If_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1325:Expr_L49_C2"}] |
#!/usr/bin/python
import sys
print "hello world!"
| ajibawa-2023/Python-Code-Large/train/row_1326 | 2 | 4 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1326:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.75, 0.25, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1326:Expr_L4_C0", "label": "print()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.25, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"hello world!\")"}] | [] |
#!/usr/bin/python
import sys
def read_and_count(filename):
words_map={}
file=open(filename, 'r')
for str in file:
arr=str.split()
for s in arr:
s=s.lower();
if s not in words_map:
words_map[s] = 1
else:
words_map[s] +=1
file.close()
return words_map
#
def print_words(filename):
words_map=read_and_count(filename)
keys=sorted(words_map.keys())
for key in keys:
print key, words_map[key]
return
#
def get_count(word):
return word[1]
def print_top(filename):
words_map = read_and_count(filename)
items = sorted(words_map.items(), key=get_count, reverse=True)
for i in items[:20]:
print i[0], i[1]
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_1327 | 39 | 52 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1327:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0577, 0.0192, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L5_C0", "label": "read_and_count", "type": "function", "loc": [5, 17], "level": 0, "parent": null, "vector": [2, 0, 0.2115, 0.25, 0, 0.66, 0.1667, 726, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "read_and_count", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def read_and_count(filename):\n words_map={}\n file=open(filename, 'r')\n for str in file:\n arr=str.split()\n for s in arr:\n s=s.lower();\n if s not in words_map:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L6_C2", "label": "words_map =", "type": "assigned_variable", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L5_C0", "vector": [14, 1, 0.1154, 0.0192, 1, 0.27, 0.0, 374, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "words_map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " words_map={}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L7_C2", "label": "file = open()", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L5_C0", "vector": [14, 1, 0.1346, 0.0192, 1, 0.27, 0.25, 107, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " file=open(filename, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L8_C2", "label": "for str", "type": "for", "loc": [8, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L5_C0", "vector": [6, 1, 0.2212, 0.1538, 1, 0.27, 0.5, 52, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "str", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for str in file:\n arr=str.split()\n for s in arr:\n s=s.lower();\n if s not in words_map:\n words_map[s] = 1\n else:\n words_map[s] +=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L9_C4", "label": "arr = split()", "type": "assigned_variable", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L8_C2", "vector": [14, 2, 0.1731, 0.0192, 2, 0.85, 0.0, 395, 3, 0, 0, 0, 908, 10, 1], "semantic": {"name": "arr", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " arr=str.split()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L10_C4", "label": "for s", "type": "for", "loc": [10, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L8_C2", "vector": [6, 2, 0.2404, 0.1154, 2, 0.85, 1.0, 553, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for s in arr:\n s=s.lower();\n if s not in words_map:\n words_map[s] = 1\n else:\n words_map[s] +=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L11_C6", "label": "s = lower()", "type": "assigned_variable", "loc": [11, 11], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L10_C4", "vector": [14, 3, 0.2115, 0.0192, 3, 0.39, 0.0, 553, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " s=s.lower();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L12_C6", "label": "if", "type": "if", "loc": [12, 15], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L10_C4", "vector": [4, 3, 0.2596, 0.0769, 3, 0.39, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if s not in words_map:\n words_map[s] = 1\n else:\n words_map[s] +=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L13_C8", "label": "assign", "type": "assigned_variable", "loc": [13, 13], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L12_C6", "vector": [14, 4, 0.25, 0.0192, 4, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " words_map[s] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:Expr_L16_C2", "label": "close()", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L5_C0", "vector": [8, 1, 0.3077, 0.0192, 1, 0.27, 0.75, 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_1327:Return_L17_C2", "label": "return", "type": "return", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L5_C0", "vector": [13, 1, 0.3269, 0.0192, 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 words_map"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L19_C0", "label": "print_words", "type": "function", "loc": [19, 24], "level": 0, "parent": null, "vector": [2, 0, 0.4135, 0.1154, 0, 0.66, 0.3333, 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 words_map=read_and_count(filename)\n keys=sorted(words_map.keys())\n for key in keys:\n print(key, words_map[key])\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L20_C2", "label": "words_map = read_and_count()", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L19_C0", "vector": [14, 1, 0.3846, 0.0192, 1, 0.24, 0.0, 374, 3, 1, 0, 0, 726, 10, 1], "semantic": {"name": "words_map", "arg_names": [], "import_names": [], "rhs_call_name": "read_and_count", "annotation": ""}, "snippet": " words_map=read_and_count(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L21_C2", "label": "keys = sorted()", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L19_C0", "vector": [14, 1, 0.4038, 0.0192, 1, 0.24, 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(words_map.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L22_C2", "label": "for key", "type": "for", "loc": [22, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L19_C0", "vector": [6, 1, 0.4327, 0.0385, 1, 0.24, 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, words_map[key])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:Expr_L23_C4", "label": "print()", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L22_C2", "vector": [8, 2, 0.4423, 0.0192, 2, 0.13, 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, words_map[key])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:Return_L24_C2", "label": "return", "type": "return", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L19_C0", "vector": [13, 1, 0.4615, 0.0192, 1, 0.24, 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_1327:FunctionDef_L26_C0", "label": "get_count", "type": "function", "loc": [26, 27], "level": 0, "parent": null, "vector": [2, 0, 0.5096, 0.0385, 0, 0.66, 0.5, 338, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_count", "arg_names": ["word"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_count(word):\n return word[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:Return_L27_C2", "label": "return", "type": "return", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L26_C0", "vector": [13, 1, 0.5192, 0.0192, 1, 0.52, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return word[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L29_C0", "label": "print_top", "type": "function", "loc": [29, 33], "level": 0, "parent": null, "vector": [2, 0, 0.5962, 0.0962, 0, 0.66, 0.6667, 148, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "print_top", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_top(filename):\n words_map = read_and_count(filename)\n items = sorted(words_map.items(), key=get_count, reverse=True)\n for i in items[:20]:\n print(i[0], i[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L30_C2", "label": "words_map = read_and_count()", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L29_C0", "vector": [14, 1, 0.5769, 0.0192, 1, 0.21, 0.0, 374, 3, 1, 0, 0, 726, 10, 1], "semantic": {"name": "words_map", "arg_names": [], "import_names": [], "rhs_call_name": "read_and_count", "annotation": ""}, "snippet": " words_map = read_and_count(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L31_C2", "label": "items = sorted()", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L29_C0", "vector": [14, 1, 0.5962, 0.0192, 1, 0.21, 0.5, 339, 3, 3, 0, 0, 134, 10, 2], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " items = sorted(words_map.items(), key=get_count, reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L32_C2", "label": "for i", "type": "for", "loc": [32, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L29_C0", "vector": [6, 1, 0.625, 0.0385, 1, 0.21, 1.0, 826, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in items[:20]:\n print(i[0], i[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:Expr_L33_C4", "label": "print()", "type": "expression", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L32_C2", "vector": [8, 2, 0.6346, 0.0192, 2, 0.9, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(i[0], i[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L36_C0", "label": "main", "type": "function", "loc": [36, 49], "level": 0, "parent": null, "vector": [2, 0, 0.8173, 0.2692, 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_1327:If_L37_C2", "label": "if", "type": "if", "loc": [37, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L36_C0", "vector": [4, 1, 0.7308, 0.0577, 1, 0.65, 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_1327:Expr_L38_C4", "label": "print()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L37_C2", "vector": [8, 2, 0.7308, 0.0192, 2, 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('usage: ./wordcount.py {--count | --topcount} file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1327:Expr_L39_C4", "label": "exit()", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L37_C2", "vector": [8, 2, 0.75, 0.0192, 2, 0.66, 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_1327:Assign_L41_C2", "label": "option =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L36_C0", "vector": [14, 1, 0.7885, 0.0192, 1, 0.65, 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_1327:Assign_L42_C2", "label": "filename =", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L36_C0", "vector": [14, 1, 0.8077, 0.0192, 1, 0.65, 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_1327:If_L43_C2", "label": "if", "type": "if", "loc": [43, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L36_C0", "vector": [4, 1, 0.8846, 0.1346, 1, 0.65, 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_1327:Expr_L44_C4", "label": "print_words()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L43_C2", "vector": [8, 2, 0.8462, 0.0192, 2, 0.22, 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_1327:If_L45_C2", "label": "if", "type": "if", "loc": [45, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L43_C2", "vector": [4, 2, 0.9038, 0.0962, 2, 0.22, 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_1327:Expr_L46_C4", "label": "print_top()", "type": "expression", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L45_C2", "vector": [8, 3, 0.8846, 0.0192, 3, 0.21, 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_1327:Expr_L48_C4", "label": "print()", "type": "expression", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L45_C2", "vector": [8, 3, 0.9231, 0.0192, 3, 0.21, 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_1327:Expr_L49_C4", "label": "exit()", "type": "expression", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L45_C2", "vector": [8, 3, 0.9423, 0.0192, 3, 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_1327:If_L51_C0", "label": "if", "type": "if", "loc": [51, 52], "level": 0, "parent": null, "vector": [4, 0, 0.9904, 0.0385, 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_1327:Expr_L52_C2", "label": "main()", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L51_C0", "vector": [8, 1, 1.0, 0.0192, 1, 0.82, 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_1327:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L6_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L7_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L8_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L8_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L8_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L11_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L12_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L12_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Expr_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Return_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L22_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Expr_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Return_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Return_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:For_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Expr_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Expr_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Assign_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L43_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L43_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L45_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L45_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L45_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Expr_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1327:If_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1327:Expr_L52_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
def mimic_dict(filename):
"""Returns mimic dict mapping each word to list of words which follow it."""
# +++your code here+++
return
def print_mimic(mimic_dict, word):
"""Given mimic dict and start word, prints 200 random words."""
# +++your code here+++
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_1328 | 17 | 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_1328:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 42], "level": 0, "parent": null, "vector": [8, 0, 0.3592, 0.4789, 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_1328:Import_L44_C0", "label": "random import random", "type": "import", "loc": [44, 44], "level": 0, "parent": null, "vector": [1, 0, 0.6197, 0.0141, 0, 0.66, 0.1667, 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_1328:Import_L45_C0", "label": "sys import sys", "type": "import", "loc": [45, 45], "level": 0, "parent": null, "vector": [1, 0, 0.6338, 0.0141, 0, 0.66, 0.3333, 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_1328:FunctionDef_L48_C0", "label": "mimic_dict", "type": "function", "loc": [48, 51], "level": 0, "parent": null, "vector": [2, 0, 0.6972, 0.0563, 0, 0.66, 0.5, 49, 0, 1, 0, 0, 0, 0, 0], "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 # +++your code here+++\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1328:Expr_L49_C2", "label": "expression", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1328:FunctionDef_L48_C0", "vector": [8, 1, 0.6901, 0.0141, 1, 0.82, 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_1328:Return_L51_C2", "label": "return", "type": "return", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1328:FunctionDef_L48_C0", "vector": [13, 1, 0.7183, 0.0141, 1, 0.82, 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_1328:FunctionDef_L54_C0", "label": "print_mimic", "type": "function", "loc": [54, 57], "level": 0, "parent": null, "vector": [2, 0, 0.7817, 0.0563, 0, 0.66, 0.6667, 927, 0, 2, 0, 0, 0, 0, 0], "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 return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1328:Expr_L55_C2", "label": "expression", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1328:FunctionDef_L54_C0", "vector": [8, 1, 0.7746, 0.0141, 1, 0.76, 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_1328:Return_L57_C2", "label": "return", "type": "return", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1328:FunctionDef_L54_C0", "vector": [13, 1, 0.8028, 0.0141, 1, 0.76, 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_1328:FunctionDef_L61_C0", "label": "main", "type": "function", "loc": [61, 67], "level": 0, "parent": null, "vector": [2, 0, 0.9014, 0.0986, 0, 0.66, 0.8333, 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_1328:If_L62_C2", "label": "if", "type": "if", "loc": [62, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1328:FunctionDef_L61_C0", "vector": [4, 1, 0.8873, 0.0423, 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_1328:Expr_L63_C4", "label": "print()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1328:If_L62_C2", "vector": [8, 2, 0.8873, 0.0141, 2, 0.75, 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_1328:Expr_L64_C4", "label": "exit()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1328:If_L62_C2", "vector": [8, 2, 0.9014, 0.0141, 2, 0.75, 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_1328:Assign_L66_C2", "label": "dict = mimic_dict()", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1328:FunctionDef_L61_C0", "vector": [14, 1, 0.9296, 0.0141, 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_1328:Expr_L67_C2", "label": "print_mimic()", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1328:FunctionDef_L61_C0", "vector": [8, 1, 0.9437, 0.0141, 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_1328: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_1328:Expr_L71_C2", "label": "main()", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1328:If_L70_C0", "vector": [8, 1, 1.0, 0.0141, 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_1328:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1328:Expr_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1328:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1328:Return_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1328:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1328:Expr_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1328:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1328:Return_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1328:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1328:If_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1328:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1328:Expr_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1328:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1328:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1328:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1328:Assign_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1328:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1328:Expr_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1328:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1328:Expr_L71_C2"}] |
#!/usr/bin/python
# 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):
arr=[]
for n in nums:
if n not in arr:
arr.append(n)
return arr
# 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):
return sorted(list1+list2)
# 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_1330 | 23 | 49 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L7_C0", "label": "remove_adjacent", "type": "function", "loc": [7, 12], "level": 0, "parent": null, "vector": [2, 0, 0.1939, 0.1224, 0, 0.66, 0.0, 855, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "remove_adjacent", "arg_names": ["nums"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def remove_adjacent(nums):\n arr=[]\n for n in nums:\n if n not in arr:\n arr.append(n)\n return arr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1330:Assign_L8_C2", "label": "arr =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L7_C0", "vector": [14, 1, 0.1633, 0.0204, 1, 0.6, 0.0, 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_1330:For_L9_C2", "label": "for n", "type": "for", "loc": [9, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L7_C0", "vector": [6, 1, 0.2041, 0.0612, 1, 0.6, 0.5, 773, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "n", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for n in nums:\n if n not in arr:\n arr.append(n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1330:If_L10_C4", "label": "if", "type": "if", "loc": [10, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1330:For_L9_C2", "vector": [4, 2, 0.2143, 0.0408, 2, 0.17, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if n not in arr:\n arr.append(n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1330:Expr_L11_C6", "label": "append()", "type": "expression", "loc": [11, 11], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1330:If_L10_C4", "vector": [8, 3, 0.2245, 0.0204, 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": " arr.append(n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1330:Return_L12_C2", "label": "return", "type": "return", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L7_C0", "vector": [13, 1, 0.2449, 0.0204, 1, 0.6, 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_1330:FunctionDef_L19_C0", "label": "linear_merge", "type": "function", "loc": [19, 20], "level": 0, "parent": null, "vector": [2, 0, 0.398, 0.0408, 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 return sorted(list1+list2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1330:Return_L20_C2", "label": "return", "type": "return", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L19_C0", "vector": [13, 1, 0.4082, 0.0204, 1, 0.58, 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_1330:FunctionDef_L25_C0", "label": "test", "type": "function", "loc": [25, 30], "level": 0, "parent": null, "vector": [2, 0, 0.5612, 0.1224, 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_1330:If_L26_C2", "label": "if", "type": "if", "loc": [26, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L25_C0", "vector": [4, 1, 0.5612, 0.0816, 1, 0.54, 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_1330:Assign_L27_C4", "label": "prefix =", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1330:If_L26_C2", "vector": [14, 2, 0.551, 0.0204, 2, 0.15, 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_1330:Assign_L29_C4", "label": "prefix =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1330:If_L26_C2", "vector": [14, 2, 0.5918, 0.0204, 2, 0.15, 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_1330:Expr_L30_C2", "label": "print()", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L25_C0", "vector": [8, 1, 0.6122, 0.0204, 1, 0.54, 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_1330:FunctionDef_L34_C0", "label": "main", "type": "function", "loc": [34, 45], "level": 0, "parent": null, "vector": [2, 0, 0.8061, 0.2449, 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_1330:Expr_L35_C2", "label": "print()", "type": "expression", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L34_C0", "vector": [8, 1, 0.7143, 0.0204, 1, 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('remove_adjacent')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1330:Expr_L36_C2", "label": "test()", "type": "expression", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L34_C0", "vector": [8, 1, 0.7347, 0.0204, 1, 0.32, 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_1330:Expr_L37_C2", "label": "test()", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L34_C0", "vector": [8, 1, 0.7551, 0.0204, 1, 0.32, 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_1330:Expr_L38_C2", "label": "test()", "type": "expression", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L34_C0", "vector": [8, 1, 0.7755, 0.0204, 1, 0.32, 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_1330:Expr_L40_C2", "label": "test()", "type": "expression", "loc": [40, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L34_C0", "vector": [8, 1, 0.8265, 0.0408, 1, 0.32, 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_1330:Expr_L42_C2", "label": "test()", "type": "expression", "loc": [42, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L34_C0", "vector": [8, 1, 0.8673, 0.0408, 1, 0.32, 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_1330:Expr_L44_C2", "label": "test()", "type": "expression", "loc": [44, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L34_C0", "vector": [8, 1, 0.9082, 0.0408, 1, 0.32, 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_1330:If_L48_C0", "label": "if", "type": "if", "loc": [48, 49], "level": 0, "parent": null, "vector": [4, 0, 0.9898, 0.0408, 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_1330:Expr_L49_C2", "label": "main()", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1330:If_L48_C0", "vector": [8, 1, 1.0, 0.0204, 1, 0.49, 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_1330:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1330:Assign_L8_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1330:For_L9_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1330:For_L9_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1330:If_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1330:If_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1330:Expr_L11_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1330:Return_L12_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1330:Return_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1330:If_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1330:If_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1330:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1330:If_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1330:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1330:Expr_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1330:Expr_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1330:Expr_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1330:Expr_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1330:Expr_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1330:Expr_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1330:Expr_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1330:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1330:Expr_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1330:If_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1330:Expr_L49_C2"}] |
#!/usr/bin/python
import sys
def read_and_count(filename):
words_map={}
file=open(filename, 'r')
for str in file:
arr=str.split()
for s in arr:
s=s.lower();
if s not in words_map:
words_map[s] = 1
else:
words_map[s] +=1
file.close()
return words_map
#
def print_words(filename):
words_map=read_and_count(filename)
keys=sorted(words_map.keys())
for key in keys:
print key, words_map[key]
return
#
def get_count(word):
return word[1]
def print_top(filename):
words_map = read_and_count(filename)
items = sorted(words_map.items(), key=get_count, reverse=True)
for i in items[:20]:
print i[0], i[1]
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_1331 | 39 | 52 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1331:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0577, 0.0192, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L5_C0", "label": "read_and_count", "type": "function", "loc": [5, 17], "level": 0, "parent": null, "vector": [2, 0, 0.2115, 0.25, 0, 0.66, 0.1667, 726, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "read_and_count", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def read_and_count(filename):\n words_map={}\n file=open(filename, 'r')\n for str in file:\n arr=str.split()\n for s in arr:\n s=s.lower();\n if s not in words_map:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L6_C2", "label": "words_map =", "type": "assigned_variable", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L5_C0", "vector": [14, 1, 0.1154, 0.0192, 1, 0.92, 0.0, 374, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "words_map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " words_map={}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L7_C2", "label": "file = open()", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L5_C0", "vector": [14, 1, 0.1346, 0.0192, 1, 0.92, 0.25, 107, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " file=open(filename, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L8_C2", "label": "for str", "type": "for", "loc": [8, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L5_C0", "vector": [6, 1, 0.2212, 0.1538, 1, 0.92, 0.5, 52, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "str", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for str in file:\n arr=str.split()\n for s in arr:\n s=s.lower();\n if s not in words_map:\n words_map[s] = 1\n else:\n words_map[s] +=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L9_C4", "label": "arr = split()", "type": "assigned_variable", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L8_C2", "vector": [14, 2, 0.1731, 0.0192, 2, 0.83, 0.0, 395, 3, 0, 0, 0, 908, 10, 1], "semantic": {"name": "arr", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " arr=str.split()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L10_C4", "label": "for s", "type": "for", "loc": [10, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L8_C2", "vector": [6, 2, 0.2404, 0.1154, 2, 0.83, 1.0, 553, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for s in arr:\n s=s.lower();\n if s not in words_map:\n words_map[s] = 1\n else:\n words_map[s] +=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L11_C6", "label": "s = lower()", "type": "assigned_variable", "loc": [11, 11], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L10_C4", "vector": [14, 3, 0.2115, 0.0192, 3, 0.32, 0.0, 553, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " s=s.lower();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L12_C6", "label": "if", "type": "if", "loc": [12, 15], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L10_C4", "vector": [4, 3, 0.2596, 0.0769, 3, 0.32, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if s not in words_map:\n words_map[s] = 1\n else:\n words_map[s] +=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L13_C8", "label": "assign", "type": "assigned_variable", "loc": [13, 13], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L12_C6", "vector": [14, 4, 0.25, 0.0192, 4, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " words_map[s] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:Expr_L16_C2", "label": "close()", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L5_C0", "vector": [8, 1, 0.3077, 0.0192, 1, 0.92, 0.75, 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_1331:Return_L17_C2", "label": "return", "type": "return", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L5_C0", "vector": [13, 1, 0.3269, 0.0192, 1, 0.92, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return words_map"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L19_C0", "label": "print_words", "type": "function", "loc": [19, 24], "level": 0, "parent": null, "vector": [2, 0, 0.4135, 0.1154, 0, 0.66, 0.3333, 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 words_map=read_and_count(filename)\n keys=sorted(words_map.keys())\n for key in keys:\n print(key, words_map[key])\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L20_C2", "label": "words_map = read_and_count()", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L19_C0", "vector": [14, 1, 0.3846, 0.0192, 1, 0.43, 0.0, 374, 3, 1, 0, 0, 726, 10, 1], "semantic": {"name": "words_map", "arg_names": [], "import_names": [], "rhs_call_name": "read_and_count", "annotation": ""}, "snippet": " words_map=read_and_count(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L21_C2", "label": "keys = sorted()", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L19_C0", "vector": [14, 1, 0.4038, 0.0192, 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(words_map.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L22_C2", "label": "for key", "type": "for", "loc": [22, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L19_C0", "vector": [6, 1, 0.4327, 0.0385, 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, words_map[key])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:Expr_L23_C4", "label": "print()", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L22_C2", "vector": [8, 2, 0.4423, 0.0192, 2, 0.58, 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, words_map[key])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:Return_L24_C2", "label": "return", "type": "return", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L19_C0", "vector": [13, 1, 0.4615, 0.0192, 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_1331:FunctionDef_L26_C0", "label": "get_count", "type": "function", "loc": [26, 27], "level": 0, "parent": null, "vector": [2, 0, 0.5096, 0.0385, 0, 0.66, 0.5, 338, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_count", "arg_names": ["word"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_count(word):\n return word[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:Return_L27_C2", "label": "return", "type": "return", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L26_C0", "vector": [13, 1, 0.5192, 0.0192, 1, 0.63, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return word[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L29_C0", "label": "print_top", "type": "function", "loc": [29, 33], "level": 0, "parent": null, "vector": [2, 0, 0.5962, 0.0962, 0, 0.66, 0.6667, 148, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "print_top", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_top(filename):\n words_map = read_and_count(filename)\n items = sorted(words_map.items(), key=get_count, reverse=True)\n for i in items[:20]:\n print(i[0], i[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L30_C2", "label": "words_map = read_and_count()", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L29_C0", "vector": [14, 1, 0.5769, 0.0192, 1, 0.9, 0.0, 374, 3, 1, 0, 0, 726, 10, 1], "semantic": {"name": "words_map", "arg_names": [], "import_names": [], "rhs_call_name": "read_and_count", "annotation": ""}, "snippet": " words_map = read_and_count(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L31_C2", "label": "items = sorted()", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L29_C0", "vector": [14, 1, 0.5962, 0.0192, 1, 0.9, 0.5, 339, 3, 3, 0, 0, 134, 10, 2], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " items = sorted(words_map.items(), key=get_count, reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L32_C2", "label": "for i", "type": "for", "loc": [32, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L29_C0", "vector": [6, 1, 0.625, 0.0385, 1, 0.9, 1.0, 826, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in items[:20]:\n print(i[0], i[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:Expr_L33_C4", "label": "print()", "type": "expression", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L32_C2", "vector": [8, 2, 0.6346, 0.0192, 2, 0.36, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(i[0], i[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L36_C0", "label": "main", "type": "function", "loc": [36, 49], "level": 0, "parent": null, "vector": [2, 0, 0.8173, 0.2692, 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_1331:If_L37_C2", "label": "if", "type": "if", "loc": [37, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L36_C0", "vector": [4, 1, 0.7308, 0.0577, 1, 0.23, 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_1331:Expr_L38_C4", "label": "print()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L37_C2", "vector": [8, 2, 0.7308, 0.0192, 2, 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('usage: ./wordcount.py {--count | --topcount} file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1331:Expr_L39_C4", "label": "exit()", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L37_C2", "vector": [8, 2, 0.75, 0.0192, 2, 0.23, 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_1331:Assign_L41_C2", "label": "option =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L36_C0", "vector": [14, 1, 0.7885, 0.0192, 1, 0.23, 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_1331:Assign_L42_C2", "label": "filename =", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L36_C0", "vector": [14, 1, 0.8077, 0.0192, 1, 0.23, 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_1331:If_L43_C2", "label": "if", "type": "if", "loc": [43, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L36_C0", "vector": [4, 1, 0.8846, 0.1346, 1, 0.23, 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_1331:Expr_L44_C4", "label": "print_words()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L43_C2", "vector": [8, 2, 0.8462, 0.0192, 2, 0.9, 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_1331:If_L45_C2", "label": "if", "type": "if", "loc": [45, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L43_C2", "vector": [4, 2, 0.9038, 0.0962, 2, 0.9, 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_1331:Expr_L46_C4", "label": "print_top()", "type": "expression", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L45_C2", "vector": [8, 3, 0.8846, 0.0192, 3, 0.01, 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_1331:Expr_L48_C4", "label": "print()", "type": "expression", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L45_C2", "vector": [8, 3, 0.9231, 0.0192, 3, 0.01, 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_1331:Expr_L49_C4", "label": "exit()", "type": "expression", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L45_C2", "vector": [8, 3, 0.9423, 0.0192, 3, 0.01, 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_1331:If_L51_C0", "label": "if", "type": "if", "loc": [51, 52], "level": 0, "parent": null, "vector": [4, 0, 0.9904, 0.0385, 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_1331:Expr_L52_C2", "label": "main()", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L51_C0", "vector": [8, 1, 1.0, 0.0192, 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": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L6_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L7_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L8_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L8_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L8_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L11_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L12_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L12_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Expr_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Return_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L22_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Expr_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Return_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Return_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:For_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Expr_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Expr_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Assign_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L43_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L43_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L45_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L45_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L45_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Expr_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1331:If_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1331:Expr_L52_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
def mimic_dict(filename):
"""Returns mimic dict mapping each word to list of words which follow it."""
# +++your code here+++
return
def print_mimic(mimic_dict, word):
"""Given mimic dict and start word, prints 200 random words."""
# +++your code here+++
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_1334 | 17 | 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_1334:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 42], "level": 0, "parent": null, "vector": [8, 0, 0.3592, 0.4789, 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_1334:Import_L44_C0", "label": "random import random", "type": "import", "loc": [44, 44], "level": 0, "parent": null, "vector": [1, 0, 0.6197, 0.0141, 0, 0.66, 0.1667, 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_1334:Import_L45_C0", "label": "sys import sys", "type": "import", "loc": [45, 45], "level": 0, "parent": null, "vector": [1, 0, 0.6338, 0.0141, 0, 0.66, 0.3333, 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_1334:FunctionDef_L48_C0", "label": "mimic_dict", "type": "function", "loc": [48, 51], "level": 0, "parent": null, "vector": [2, 0, 0.6972, 0.0563, 0, 0.66, 0.5, 49, 0, 1, 0, 0, 0, 0, 0], "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 # +++your code here+++\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1334:Expr_L49_C2", "label": "expression", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1334:FunctionDef_L48_C0", "vector": [8, 1, 0.6901, 0.0141, 1, 0.16, 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_1334:Return_L51_C2", "label": "return", "type": "return", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1334:FunctionDef_L48_C0", "vector": [13, 1, 0.7183, 0.0141, 1, 0.16, 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_1334:FunctionDef_L54_C0", "label": "print_mimic", "type": "function", "loc": [54, 57], "level": 0, "parent": null, "vector": [2, 0, 0.7817, 0.0563, 0, 0.66, 0.6667, 927, 0, 2, 0, 0, 0, 0, 0], "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 return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1334:Expr_L55_C2", "label": "expression", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1334:FunctionDef_L54_C0", "vector": [8, 1, 0.7746, 0.0141, 1, 0.39, 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_1334:Return_L57_C2", "label": "return", "type": "return", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1334:FunctionDef_L54_C0", "vector": [13, 1, 0.8028, 0.0141, 1, 0.39, 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_1334:FunctionDef_L61_C0", "label": "main", "type": "function", "loc": [61, 67], "level": 0, "parent": null, "vector": [2, 0, 0.9014, 0.0986, 0, 0.66, 0.8333, 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_1334:If_L62_C2", "label": "if", "type": "if", "loc": [62, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1334:FunctionDef_L61_C0", "vector": [4, 1, 0.8873, 0.0423, 1, 0.94, 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_1334:Expr_L63_C4", "label": "print()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1334:If_L62_C2", "vector": [8, 2, 0.8873, 0.0141, 2, 0.61, 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_1334:Expr_L64_C4", "label": "exit()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1334:If_L62_C2", "vector": [8, 2, 0.9014, 0.0141, 2, 0.61, 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_1334:Assign_L66_C2", "label": "dict = mimic_dict()", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1334:FunctionDef_L61_C0", "vector": [14, 1, 0.9296, 0.0141, 1, 0.94, 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_1334:Expr_L67_C2", "label": "print_mimic()", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1334:FunctionDef_L61_C0", "vector": [8, 1, 0.9437, 0.0141, 1, 0.94, 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_1334: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_1334:Expr_L71_C2", "label": "main()", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1334:If_L70_C0", "vector": [8, 1, 1.0, 0.0141, 1, 0.73, 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_1334:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1334:Expr_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1334:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1334:Return_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1334:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1334:Expr_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1334:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1334:Return_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1334:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1334:If_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1334:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1334:Expr_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1334:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1334:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1334:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1334:Assign_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1334:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1334:Expr_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1334:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1334: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/
# 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+++
return
# 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
# 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_1338 | 19 | 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_1338:FunctionDef_L15_C0", "label": "remove_adjacent", "type": "function", "loc": [15, 17], "level": 0, "parent": null, "vector": [2, 0, 0.254, 0.0476, 0, 0.66, 0.0, 855, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "remove_adjacent", "arg_names": ["nums"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def remove_adjacent(nums):\n # +++your code here+++\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1338:Return_L17_C2", "label": "return", "type": "return", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L15_C0", "vector": [13, 1, 0.2698, 0.0159, 1, 0.45, 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_1338:FunctionDef_L24_C0", "label": "linear_merge", "type": "function", "loc": [24, 26], "level": 0, "parent": null, "vector": [2, 0, 0.3968, 0.0476, 0, 0.66, 0.25, 96, 0, 2, 0, 0, 0, 0, 0], "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 return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1338:Return_L26_C2", "label": "return", "type": "return", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L24_C0", "vector": [13, 1, 0.4127, 0.0159, 1, 0.67, 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_1338:FunctionDef_L39_C0", "label": "test", "type": "function", "loc": [39, 44], "level": 0, "parent": null, "vector": [2, 0, 0.6587, 0.0952, 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_1338:If_L40_C2", "label": "if", "type": "if", "loc": [40, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L39_C0", "vector": [4, 1, 0.6587, 0.0635, 1, 0.13, 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_1338:Assign_L41_C4", "label": "prefix =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1338:If_L40_C2", "vector": [14, 2, 0.6508, 0.0159, 2, 0.52, 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_1338:Assign_L43_C4", "label": "prefix =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1338:If_L40_C2", "vector": [14, 2, 0.6825, 0.0159, 2, 0.52, 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_1338:Expr_L44_C2", "label": "print()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L39_C0", "vector": [8, 1, 0.6984, 0.0159, 1, 0.13, 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_1338:FunctionDef_L48_C0", "label": "main", "type": "function", "loc": [48, 59], "level": 0, "parent": null, "vector": [2, 0, 0.8492, 0.1905, 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_1338:Expr_L49_C2", "label": "print()", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L48_C0", "vector": [8, 1, 0.7778, 0.0159, 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_1338:Expr_L50_C2", "label": "test()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L48_C0", "vector": [8, 1, 0.7937, 0.0159, 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_1338:Expr_L51_C2", "label": "test()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L48_C0", "vector": [8, 1, 0.8095, 0.0159, 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_1338:Expr_L52_C2", "label": "test()", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L48_C0", "vector": [8, 1, 0.8254, 0.0159, 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_1338:Expr_L54_C2", "label": "test()", "type": "expression", "loc": [54, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L48_C0", "vector": [8, 1, 0.8651, 0.0317, 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_1338:Expr_L56_C2", "label": "test()", "type": "expression", "loc": [56, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L48_C0", "vector": [8, 1, 0.8968, 0.0317, 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_1338:Expr_L58_C2", "label": "test()", "type": "expression", "loc": [58, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L48_C0", "vector": [8, 1, 0.9286, 0.0317, 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_1338:If_L62_C0", "label": "if", "type": "if", "loc": [62, 63], "level": 0, "parent": null, "vector": [4, 0, 0.9921, 0.0317, 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_1338:Expr_L63_C2", "label": "main()", "type": "expression", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1338:If_L62_C0", "vector": [8, 1, 1.0, 0.0159, 1, 0.65, 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_1338:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1338:Return_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1338:Return_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1338:If_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1338:If_L40_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1338:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1338:If_L40_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1338:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1338:Expr_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1338:Expr_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1338:Expr_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1338:Expr_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1338:Expr_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1338:Expr_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1338:Expr_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1338:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1338:Expr_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1338:If_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1338:Expr_L63_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
# +++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_1339 | 16 | 68 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1339:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 38], "level": 0, "parent": null, "vector": [8, 0, 0.3456, 0.4412, 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_1339:Import_L40_C0", "label": "sys import sys", "type": "import", "loc": [40, 40], "level": 0, "parent": null, "vector": [1, 0, 0.5882, 0.0147, 0, 0.66, 0.3333, 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_1339:FunctionDef_L52_C0", "label": "main", "type": "function", "loc": [52, 65], "level": 0, "parent": null, "vector": [2, 0, 0.8603, 0.2059, 0, 0.66, 0.6667, 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_1339:If_L53_C2", "label": "if", "type": "if", "loc": [53, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1339:FunctionDef_L52_C0", "vector": [4, 1, 0.7941, 0.0441, 1, 0.6, 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_1339:Expr_L54_C4", "label": "print()", "type": "expression", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1339:If_L53_C2", "vector": [8, 2, 0.7941, 0.0147, 2, 0.55, 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_1339:Expr_L55_C4", "label": "exit()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1339:If_L53_C2", "vector": [8, 2, 0.8088, 0.0147, 2, 0.55, 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_1339:Assign_L57_C2", "label": "option =", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1339:FunctionDef_L52_C0", "vector": [14, 1, 0.8382, 0.0147, 1, 0.6, 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_1339:Assign_L58_C2", "label": "filename =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1339:FunctionDef_L52_C0", "vector": [14, 1, 0.8529, 0.0147, 1, 0.6, 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_1339:If_L59_C2", "label": "if", "type": "if", "loc": [59, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1339:FunctionDef_L52_C0", "vector": [4, 1, 0.9118, 0.1029, 1, 0.6, 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_1339:Expr_L60_C4", "label": "print_words()", "type": "expression", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1339:If_L59_C2", "vector": [8, 2, 0.8824, 0.0147, 2, 0.68, 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_1339:If_L61_C2", "label": "if", "type": "if", "loc": [61, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1339:If_L59_C2", "vector": [4, 2, 0.9265, 0.0735, 2, 0.68, 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_1339:Expr_L62_C4", "label": "print_top()", "type": "expression", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1339:If_L61_C2", "vector": [8, 3, 0.9118, 0.0147, 3, 0.23, 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_1339:Expr_L64_C4", "label": "print()", "type": "expression", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1339:If_L61_C2", "vector": [8, 3, 0.9412, 0.0147, 3, 0.23, 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_1339:Expr_L65_C4", "label": "exit()", "type": "expression", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1339:If_L61_C2", "vector": [8, 3, 0.9559, 0.0147, 3, 0.23, 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_1339:If_L67_C0", "label": "if", "type": "if", "loc": [67, 68], "level": 0, "parent": null, "vector": [4, 0, 0.9926, 0.0294, 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_1339:Expr_L68_C2", "label": "main()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1339:If_L67_C0", "vector": [8, 1, 1.0, 0.0147, 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_1339:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1339:If_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1339:If_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1339:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1339:If_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1339:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1339:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1339:Assign_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1339:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1339:Assign_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1339:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1339:If_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1339:If_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1339:Expr_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1339:If_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1339:If_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1339:If_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1339:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1339:If_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1339:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1339:If_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1339:Expr_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1339:If_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1339:Expr_L68_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
def mimic_dict(filename):
"""Returns mimic dict mapping each word to list of words which follow it."""
# +++your code here+++
return
def print_mimic(mimic_dict, word):
"""Given mimic dict and start word, prints 200 random words."""
# +++your code here+++
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_1340 | 17 | 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_1340:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 42], "level": 0, "parent": null, "vector": [8, 0, 0.3592, 0.4789, 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_1340:Import_L44_C0", "label": "random import random", "type": "import", "loc": [44, 44], "level": 0, "parent": null, "vector": [1, 0, 0.6197, 0.0141, 0, 0.66, 0.1667, 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_1340:Import_L45_C0", "label": "sys import sys", "type": "import", "loc": [45, 45], "level": 0, "parent": null, "vector": [1, 0, 0.6338, 0.0141, 0, 0.66, 0.3333, 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_1340:FunctionDef_L48_C0", "label": "mimic_dict", "type": "function", "loc": [48, 51], "level": 0, "parent": null, "vector": [2, 0, 0.6972, 0.0563, 0, 0.66, 0.5, 49, 0, 1, 0, 0, 0, 0, 0], "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 # +++your code here+++\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1340:Expr_L49_C2", "label": "expression", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1340:FunctionDef_L48_C0", "vector": [8, 1, 0.6901, 0.0141, 1, 0.6, 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_1340:Return_L51_C2", "label": "return", "type": "return", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1340:FunctionDef_L48_C0", "vector": [13, 1, 0.7183, 0.0141, 1, 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_1340:FunctionDef_L54_C0", "label": "print_mimic", "type": "function", "loc": [54, 57], "level": 0, "parent": null, "vector": [2, 0, 0.7817, 0.0563, 0, 0.66, 0.6667, 927, 0, 2, 0, 0, 0, 0, 0], "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 return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1340:Expr_L55_C2", "label": "expression", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1340:FunctionDef_L54_C0", "vector": [8, 1, 0.7746, 0.0141, 1, 0.11, 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_1340:Return_L57_C2", "label": "return", "type": "return", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1340:FunctionDef_L54_C0", "vector": [13, 1, 0.8028, 0.0141, 1, 0.11, 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_1340:FunctionDef_L61_C0", "label": "main", "type": "function", "loc": [61, 67], "level": 0, "parent": null, "vector": [2, 0, 0.9014, 0.0986, 0, 0.66, 0.8333, 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_1340:If_L62_C2", "label": "if", "type": "if", "loc": [62, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1340:FunctionDef_L61_C0", "vector": [4, 1, 0.8873, 0.0423, 1, 0.86, 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_1340:Expr_L63_C4", "label": "print()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1340:If_L62_C2", "vector": [8, 2, 0.8873, 0.0141, 2, 0.47, 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_1340:Expr_L64_C4", "label": "exit()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1340:If_L62_C2", "vector": [8, 2, 0.9014, 0.0141, 2, 0.47, 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_1340:Assign_L66_C2", "label": "dict = mimic_dict()", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1340:FunctionDef_L61_C0", "vector": [14, 1, 0.9296, 0.0141, 1, 0.86, 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_1340:Expr_L67_C2", "label": "print_mimic()", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1340:FunctionDef_L61_C0", "vector": [8, 1, 0.9437, 0.0141, 1, 0.86, 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_1340: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_1340:Expr_L71_C2", "label": "main()", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1340:If_L70_C0", "vector": [8, 1, 1.0, 0.0141, 1, 0.79, 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_1340:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1340:Expr_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1340:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1340:Return_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1340:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1340:Expr_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1340:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1340:Return_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1340:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1340:If_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1340:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1340:Expr_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1340:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1340:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1340:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1340:Assign_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1340:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1340:Expr_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1340:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1340: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/
# 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+++
return
# 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
# 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_1342 | 19 | 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_1342:FunctionDef_L15_C0", "label": "remove_adjacent", "type": "function", "loc": [15, 17], "level": 0, "parent": null, "vector": [2, 0, 0.254, 0.0476, 0, 0.66, 0.0, 855, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "remove_adjacent", "arg_names": ["nums"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def remove_adjacent(nums):\n # +++your code here+++\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1342:Return_L17_C2", "label": "return", "type": "return", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L15_C0", "vector": [13, 1, 0.2698, 0.0159, 1, 0.03, 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_1342:FunctionDef_L24_C0", "label": "linear_merge", "type": "function", "loc": [24, 26], "level": 0, "parent": null, "vector": [2, 0, 0.3968, 0.0476, 0, 0.66, 0.25, 96, 0, 2, 0, 0, 0, 0, 0], "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 return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1342:Return_L26_C2", "label": "return", "type": "return", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L24_C0", "vector": [13, 1, 0.4127, 0.0159, 1, 0.41, 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_1342:FunctionDef_L39_C0", "label": "test", "type": "function", "loc": [39, 44], "level": 0, "parent": null, "vector": [2, 0, 0.6587, 0.0952, 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_1342:If_L40_C2", "label": "if", "type": "if", "loc": [40, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L39_C0", "vector": [4, 1, 0.6587, 0.0635, 1, 0.39, 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_1342:Assign_L41_C4", "label": "prefix =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1342:If_L40_C2", "vector": [14, 2, 0.6508, 0.0159, 2, 0.18, 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_1342:Assign_L43_C4", "label": "prefix =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1342:If_L40_C2", "vector": [14, 2, 0.6825, 0.0159, 2, 0.18, 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_1342:Expr_L44_C2", "label": "print()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L39_C0", "vector": [8, 1, 0.6984, 0.0159, 1, 0.39, 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_1342:FunctionDef_L48_C0", "label": "main", "type": "function", "loc": [48, 59], "level": 0, "parent": null, "vector": [2, 0, 0.8492, 0.1905, 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_1342:Expr_L49_C2", "label": "print()", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L48_C0", "vector": [8, 1, 0.7778, 0.0159, 1, 0.49, 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_1342:Expr_L50_C2", "label": "test()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L48_C0", "vector": [8, 1, 0.7937, 0.0159, 1, 0.49, 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_1342:Expr_L51_C2", "label": "test()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L48_C0", "vector": [8, 1, 0.8095, 0.0159, 1, 0.49, 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_1342:Expr_L52_C2", "label": "test()", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L48_C0", "vector": [8, 1, 0.8254, 0.0159, 1, 0.49, 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_1342:Expr_L54_C2", "label": "test()", "type": "expression", "loc": [54, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L48_C0", "vector": [8, 1, 0.8651, 0.0317, 1, 0.49, 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_1342:Expr_L56_C2", "label": "test()", "type": "expression", "loc": [56, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L48_C0", "vector": [8, 1, 0.8968, 0.0317, 1, 0.49, 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_1342:Expr_L58_C2", "label": "test()", "type": "expression", "loc": [58, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L48_C0", "vector": [8, 1, 0.9286, 0.0317, 1, 0.49, 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_1342:If_L62_C0", "label": "if", "type": "if", "loc": [62, 63], "level": 0, "parent": null, "vector": [4, 0, 0.9921, 0.0317, 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_1342:Expr_L63_C2", "label": "main()", "type": "expression", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1342:If_L62_C0", "vector": [8, 1, 1.0, 0.0159, 1, 0.13, 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_1342:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1342:Return_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1342:Return_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1342:If_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1342:If_L40_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1342:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1342:If_L40_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1342:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1342:Expr_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1342:Expr_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1342:Expr_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1342:Expr_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1342:Expr_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1342:Expr_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1342:Expr_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1342:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1342:Expr_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1342:If_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1342:Expr_L63_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
# +++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_1343 | 16 | 68 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1343:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 38], "level": 0, "parent": null, "vector": [8, 0, 0.3456, 0.4412, 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_1343:Import_L40_C0", "label": "sys import sys", "type": "import", "loc": [40, 40], "level": 0, "parent": null, "vector": [1, 0, 0.5882, 0.0147, 0, 0.66, 0.3333, 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_1343:FunctionDef_L52_C0", "label": "main", "type": "function", "loc": [52, 65], "level": 0, "parent": null, "vector": [2, 0, 0.8603, 0.2059, 0, 0.66, 0.6667, 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_1343:If_L53_C2", "label": "if", "type": "if", "loc": [53, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1343:FunctionDef_L52_C0", "vector": [4, 1, 0.7941, 0.0441, 1, 0.01, 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_1343:Expr_L54_C4", "label": "print()", "type": "expression", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1343:If_L53_C2", "vector": [8, 2, 0.7941, 0.0147, 2, 0.91, 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_1343:Expr_L55_C4", "label": "exit()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1343:If_L53_C2", "vector": [8, 2, 0.8088, 0.0147, 2, 0.91, 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_1343:Assign_L57_C2", "label": "option =", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1343:FunctionDef_L52_C0", "vector": [14, 1, 0.8382, 0.0147, 1, 0.01, 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_1343:Assign_L58_C2", "label": "filename =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1343:FunctionDef_L52_C0", "vector": [14, 1, 0.8529, 0.0147, 1, 0.01, 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_1343:If_L59_C2", "label": "if", "type": "if", "loc": [59, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1343:FunctionDef_L52_C0", "vector": [4, 1, 0.9118, 0.1029, 1, 0.01, 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_1343:Expr_L60_C4", "label": "print_words()", "type": "expression", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1343:If_L59_C2", "vector": [8, 2, 0.8824, 0.0147, 2, 0.59, 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_1343:If_L61_C2", "label": "if", "type": "if", "loc": [61, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1343:If_L59_C2", "vector": [4, 2, 0.9265, 0.0735, 2, 0.59, 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_1343:Expr_L62_C4", "label": "print_top()", "type": "expression", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1343:If_L61_C2", "vector": [8, 3, 0.9118, 0.0147, 3, 0.06, 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_1343:Expr_L64_C4", "label": "print()", "type": "expression", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1343:If_L61_C2", "vector": [8, 3, 0.9412, 0.0147, 3, 0.06, 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_1343:Expr_L65_C4", "label": "exit()", "type": "expression", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1343:If_L61_C2", "vector": [8, 3, 0.9559, 0.0147, 3, 0.06, 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_1343:If_L67_C0", "label": "if", "type": "if", "loc": [67, 68], "level": 0, "parent": null, "vector": [4, 0, 0.9926, 0.0294, 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_1343:Expr_L68_C2", "label": "main()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1343:If_L67_C0", "vector": [8, 1, 1.0, 0.0147, 1, 0.25, 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_1343:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1343:If_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1343:If_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1343:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1343:If_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1343:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1343:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1343:Assign_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1343:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1343:Assign_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1343:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1343:If_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1343:If_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1343:Expr_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1343:If_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1343:If_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1343:If_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1343:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1343:If_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1343:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1343:If_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1343:Expr_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1343:If_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1343:Expr_L68_C2"}] |
#!/usr/bin/python
# 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/
import sys
import re
"""Baby Names exercise
Define the extract_names() function below and change main()
to call it.
For writing regex, it's nice to include a copy of the target
text for inspiration.
Here's what the html looks like in the baby.html files:
...
<h3 align="center">Popularity in 1990</h3>
....
<tr align="right"><td>1</td><td>Michael</td><td>Jessica</td>
<tr align="right"><td>2</td><td>Christopher</td><td>Ashley</td>
<tr align="right"><td>3</td><td>Matthew</td><td>Brittany</td>
...
Suggested milestones for incremental development:
-Extract the year and print it
-Extract the names and rank numbers and just print them
-Get the names data into a dict and print it
-Build the [year, 'name rank', ... ] list and print it
-Fix main() to use the extract_names list
"""
def extract_names(filename):
"""
Given a file name for baby.html, returns a list starting with the year string
followed by the name-rank strings in alphabetical order.
['2006', 'Aaliyah 91', Aaron 57', 'Abagail 895', ' ...]
"""
# +++your code here+++
return
def main():
# This command-line parsing code is provided.
# Make a list of command line arguments, omitting the [0] element
# which is the script itself.
args = sys.argv[1:]
if not args:
print 'usage: [--summaryfile] file [file ...]'
sys.exit(1)
# Notice the summary flag and remove it from args if it is present.
summary = False
if args[0] == '--summaryfile':
summary = True
del args[0]
# +++your code here+++
# For each filename, get the names, then either print the text output
# or write it to a summary file
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1345 | 16 | 68 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1345:Import_L9_C0", "label": "sys import sys", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1324, 0.0147, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1345:Import_L10_C0", "label": "re import re", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1471, 0.0147, 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_1345:Expr_L12_C0", "label": "expression", "type": "expression", "loc": [12, 35], "level": 0, "parent": null, "vector": [8, 0, 0.3456, 0.3529, 0, 0.66, 0.4, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Baby Names exercise\n\nDefine the extract_names() function below and change main()\nto call it.\n\nFor writing regex, it's nice to include a copy of the target\ntext for inspiration.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1345:FunctionDef_L37_C0", "label": "extract_names", "type": "function", "loc": [37, 44], "level": 0, "parent": null, "vector": [2, 0, 0.5956, 0.1176, 0, 0.66, 0.6, 851, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "extract_names", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def extract_names(filename):\n \"\"\"\n Given a file name for baby.html, returns a list starting with the year string\n followed by the name-rank strings in alphabetical order.\n ['2006', 'Aaliyah 91', Aaron 57', 'Abagail 895', ' ...]\n \"\"\"\n # +++your code here+++\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1345:Expr_L38_C2", "label": "expression", "type": "expression", "loc": [38, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1345:FunctionDef_L37_C0", "vector": [8, 1, 0.5882, 0.0735, 1, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Given a file name for baby.html, returns a list starting with the year string\n followed by the name-rank strings in alphabetical order.\n ['2006', 'Aaliyah 91', Aaron 57', 'Abagail 895', ' ...]\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1345:Return_L44_C2", "label": "return", "type": "return", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1345:FunctionDef_L37_C0", "vector": [13, 1, 0.6471, 0.0147, 1, 0.57, 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_1345:FunctionDef_L47_C0", "label": "main", "type": "function", "loc": [47, 61], "level": 0, "parent": null, "vector": [2, 0, 0.7941, 0.2206, 0, 0.66, 0.8, 624, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n # This command-line parsing code is provided.\n # Make a list of command line arguments, omitting the [0] element\n # which is the script itself.\n args = sys.argv[1:]\n\n if not args:\n print('usage: [--summaryfile] file [file ...]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1345:Assign_L51_C2", "label": "args =", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1345:FunctionDef_L47_C0", "vector": [14, 1, 0.75, 0.0147, 1, 0.14, 0.0, 805, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = sys.argv[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1345:If_L53_C2", "label": "if", "type": "if", "loc": [53, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1345:FunctionDef_L47_C0", "vector": [4, 1, 0.7941, 0.0441, 1, 0.14, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not args:\n print('usage: [--summaryfile] file [file ...]')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1345:Expr_L54_C4", "label": "print()", "type": "expression", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1345:If_L53_C2", "vector": [8, 2, 0.7941, 0.0147, 2, 0.0, 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: [--summaryfile] file [file ...]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1345:Expr_L55_C4", "label": "exit()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1345:If_L53_C2", "vector": [8, 2, 0.8088, 0.0147, 2, 0.0, 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_1345:Assign_L58_C2", "label": "summary =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1345:FunctionDef_L47_C0", "vector": [14, 1, 0.8529, 0.0147, 1, 0.14, 0.6667, 977, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "summary", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " summary = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1345:If_L59_C2", "label": "if", "type": "if", "loc": [59, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1345:FunctionDef_L47_C0", "vector": [4, 1, 0.8824, 0.0441, 1, 0.14, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args[0] == '--summaryfile':\n summary = True\n del args[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1345:Assign_L60_C4", "label": "summary =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1345:If_L59_C2", "vector": [14, 2, 0.8824, 0.0147, 2, 0.39, 0.0, 977, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "summary", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " summary = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1345:If_L67_C0", "label": "if", "type": "if", "loc": [67, 68], "level": 0, "parent": null, "vector": [4, 0, 0.9926, 0.0294, 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_1345:Expr_L68_C2", "label": "main()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1345:If_L67_C0", "vector": [8, 1, 1.0, 0.0147, 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": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1345:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1345:Expr_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1345:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1345:Return_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1345:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1345:Assign_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1345:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1345:If_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1345:If_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1345:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1345:If_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1345:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1345:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1345:Assign_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1345:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1345:If_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1345:If_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1345:Assign_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1345:If_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1345:Expr_L68_C2"}] |
#!/usr/bin/python
# 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/
import sys
import re
"""Baby Names exercise
Define the extract_names() function below and change main()
to call it.
For writing regex, it's nice to include a copy of the target
text for inspiration.
Here's what the html looks like in the baby.html files:
...
<h3 align="center">Popularity in 1990</h3>
....
<tr align="right"><td>1</td><td>Michael</td><td>Jessica</td>
<tr align="right"><td>2</td><td>Christopher</td><td>Ashley</td>
<tr align="right"><td>3</td><td>Matthew</td><td>Brittany</td>
...
Suggested milestones for incremental development:
-Extract the year and print it
-Extract the names and rank numbers and just print them
-Get the names data into a dict and print it
-Build the [year, 'name rank', ... ] list and print it
-Fix main() to use the extract_names list
"""
def extract_names(filename):
"""
Given a file name for baby.html, returns a list starting with the year string
followed by the name-rank strings in alphabetical order.
['2006', 'Aaliyah 91', Aaron 57', 'Abagail 895', ' ...]
"""
# +++your code here+++
return
def main():
# This command-line parsing code is provided.
# Make a list of command line arguments, omitting the [0] element
# which is the script itself.
args = sys.argv[1:]
if not args:
print 'usage: [--summaryfile] file [file ...]'
sys.exit(1)
# Notice the summary flag and remove it from args if it is present.
summary = False
if args[0] == '--summaryfile':
summary = True
del args[0]
# +++your code here+++
# For each filename, get the names, then either print the text output
# or write it to a summary file
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1346 | 16 | 68 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1346:Import_L9_C0", "label": "sys import sys", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1324, 0.0147, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1346:Import_L10_C0", "label": "re import re", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1471, 0.0147, 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_1346:Expr_L12_C0", "label": "expression", "type": "expression", "loc": [12, 35], "level": 0, "parent": null, "vector": [8, 0, 0.3456, 0.3529, 0, 0.66, 0.4, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Baby Names exercise\n\nDefine the extract_names() function below and change main()\nto call it.\n\nFor writing regex, it's nice to include a copy of the target\ntext for inspiration.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1346:FunctionDef_L37_C0", "label": "extract_names", "type": "function", "loc": [37, 44], "level": 0, "parent": null, "vector": [2, 0, 0.5956, 0.1176, 0, 0.66, 0.6, 851, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "extract_names", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def extract_names(filename):\n \"\"\"\n Given a file name for baby.html, returns a list starting with the year string\n followed by the name-rank strings in alphabetical order.\n ['2006', 'Aaliyah 91', Aaron 57', 'Abagail 895', ' ...]\n \"\"\"\n # +++your code here+++\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1346:Expr_L38_C2", "label": "expression", "type": "expression", "loc": [38, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1346:FunctionDef_L37_C0", "vector": [8, 1, 0.5882, 0.0735, 1, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Given a file name for baby.html, returns a list starting with the year string\n followed by the name-rank strings in alphabetical order.\n ['2006', 'Aaliyah 91', Aaron 57', 'Abagail 895', ' ...]\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1346:Return_L44_C2", "label": "return", "type": "return", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1346:FunctionDef_L37_C0", "vector": [13, 1, 0.6471, 0.0147, 1, 0.79, 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_1346:FunctionDef_L47_C0", "label": "main", "type": "function", "loc": [47, 61], "level": 0, "parent": null, "vector": [2, 0, 0.7941, 0.2206, 0, 0.66, 0.8, 624, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n # This command-line parsing code is provided.\n # Make a list of command line arguments, omitting the [0] element\n # which is the script itself.\n args = sys.argv[1:]\n\n if not args:\n print('usage: [--summaryfile] file [file ...]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1346:Assign_L51_C2", "label": "args =", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1346:FunctionDef_L47_C0", "vector": [14, 1, 0.75, 0.0147, 1, 0.88, 0.0, 805, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = sys.argv[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1346:If_L53_C2", "label": "if", "type": "if", "loc": [53, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1346:FunctionDef_L47_C0", "vector": [4, 1, 0.7941, 0.0441, 1, 0.88, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not args:\n print('usage: [--summaryfile] file [file ...]')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1346:Expr_L54_C4", "label": "print()", "type": "expression", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1346:If_L53_C2", "vector": [8, 2, 0.7941, 0.0147, 2, 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('usage: [--summaryfile] file [file ...]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1346:Expr_L55_C4", "label": "exit()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1346:If_L53_C2", "vector": [8, 2, 0.8088, 0.0147, 2, 0.01, 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_1346:Assign_L58_C2", "label": "summary =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1346:FunctionDef_L47_C0", "vector": [14, 1, 0.8529, 0.0147, 1, 0.88, 0.6667, 977, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "summary", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " summary = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1346:If_L59_C2", "label": "if", "type": "if", "loc": [59, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1346:FunctionDef_L47_C0", "vector": [4, 1, 0.8824, 0.0441, 1, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args[0] == '--summaryfile':\n summary = True\n del args[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1346:Assign_L60_C4", "label": "summary =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1346:If_L59_C2", "vector": [14, 2, 0.8824, 0.0147, 2, 0.42, 0.0, 977, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "summary", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " summary = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1346:If_L67_C0", "label": "if", "type": "if", "loc": [67, 68], "level": 0, "parent": null, "vector": [4, 0, 0.9926, 0.0294, 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_1346:Expr_L68_C2", "label": "main()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1346:If_L67_C0", "vector": [8, 1, 1.0, 0.0147, 1, 0.02, 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_1346:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1346:Expr_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1346:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1346:Return_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1346:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1346:Assign_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1346:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1346:If_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1346:If_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1346:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1346:If_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1346:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1346:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1346:Assign_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1346:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1346:If_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1346:If_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1346:Assign_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1346:If_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1346:Expr_L68_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/
"""A tiny Python program to check that Python is working.
Try running this program from the command line like this:
python hello.py
python hello.py Alice
That should print:
Hello World -or- Hello Alice
Try changing the 'Hello' to 'Howdy' and run again.
Once you have that working, you're ready for class -- you can edit
and run Python code; now you just need to learn Python!
"""
import sys
# Define a main() function that prints a little greeting.
def main():
# Get the name from the command line, using 'World' as a fallback.
if len(sys.argv) >= 2:
name = sys.argv[1]
else:
name = 'World'
print 'Hello', name
# This is the standard boilerplate that calls the main() function.
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1347 | 9 | 33 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1347:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 18], "level": 0, "parent": null, "vector": [8, 0, 0.4091, 0.303, 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 tiny Python program to check that Python is working.\nTry running this program from the command line like this:\n python hello.py\n python hello.py Alice\nThat should print:\n Hello World -or- Hello Alice\nTry changing the 'Hello' to 'Howdy' and run again.\nOnce you have that working, you're ready for class -- you can edit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1347:Import_L20_C0", "label": "sys import sys", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.6061, 0.0303, 0, 0.66, 0.3333, 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_1347:FunctionDef_L23_C0", "label": "main", "type": "function", "loc": [23, 29], "level": 0, "parent": null, "vector": [2, 0, 0.7879, 0.2121, 0, 0.66, 0.6667, 624, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n # Get the name from the command line, using 'World' as a fallback.\n if len(sys.argv) >= 2:\n name = sys.argv[1]\n else:\n name = 'World'\n print('Hello', name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1347:If_L25_C2", "label": "if", "type": "if", "loc": [25, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1347:FunctionDef_L23_C0", "vector": [4, 1, 0.803, 0.1212, 1, 0.91, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) >= 2:\n name = sys.argv[1]\n else:\n name = 'World'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1347:Assign_L26_C4", "label": "name =", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1347:If_L25_C2", "vector": [14, 2, 0.7879, 0.0303, 2, 0.23, 0.0, 57, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1347:Assign_L28_C4", "label": "name =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1347:If_L25_C2", "vector": [14, 2, 0.8485, 0.0303, 2, 0.23, 1.0, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = 'World'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1347:Expr_L29_C2", "label": "print()", "type": "expression", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1347:FunctionDef_L23_C0", "vector": [8, 1, 0.8788, 0.0303, 1, 0.91, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Hello', name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1347:If_L32_C0", "label": "if", "type": "if", "loc": [32, 33], "level": 0, "parent": null, "vector": [4, 0, 0.9848, 0.0606, 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_1347:Expr_L33_C2", "label": "main()", "type": "expression", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1347:If_L32_C0", "vector": [8, 1, 1.0, 0.0303, 1, 0.14, 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_1347:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1347:If_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1347:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1347:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1347:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1347:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1347:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1347:Expr_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1347:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1347:Expr_L33_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/
"""A tiny Python program to check that Python is working.
Try running this program from the command line like this:
python hello.py
python hello.py Alice
That should print:
Hello World -or- Hello Alice
Try changing the 'Hello' to 'Howdy' and run again.
Once you have that working, you're ready for class -- you can edit
and run Python code; now you just need to learn Python!
"""
import sys
# Define a main() function that prints a little greeting.
def main():
# Get the name from the command line, using 'World' as a fallback.
if len(sys.argv) >= 2:
name = sys.argv[1]
else:
name = 'World'
print 'Hello', name
# This is the standard boilerplate that calls the main() function.
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1348 | 9 | 33 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1348:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 18], "level": 0, "parent": null, "vector": [8, 0, 0.4091, 0.303, 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 tiny Python program to check that Python is working.\nTry running this program from the command line like this:\n python hello.py\n python hello.py Alice\nThat should print:\n Hello World -or- Hello Alice\nTry changing the 'Hello' to 'Howdy' and run again.\nOnce you have that working, you're ready for class -- you can edit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1348:Import_L20_C0", "label": "sys import sys", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.6061, 0.0303, 0, 0.66, 0.3333, 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_1348:FunctionDef_L23_C0", "label": "main", "type": "function", "loc": [23, 29], "level": 0, "parent": null, "vector": [2, 0, 0.7879, 0.2121, 0, 0.66, 0.6667, 624, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n # Get the name from the command line, using 'World' as a fallback.\n if len(sys.argv) >= 2:\n name = sys.argv[1]\n else:\n name = 'World'\n print('Hello', name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1348:If_L25_C2", "label": "if", "type": "if", "loc": [25, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1348:FunctionDef_L23_C0", "vector": [4, 1, 0.803, 0.1212, 1, 0.75, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) >= 2:\n name = sys.argv[1]\n else:\n name = 'World'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1348:Assign_L26_C4", "label": "name =", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1348:If_L25_C2", "vector": [14, 2, 0.7879, 0.0303, 2, 0.44, 0.0, 57, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1348:Assign_L28_C4", "label": "name =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1348:If_L25_C2", "vector": [14, 2, 0.8485, 0.0303, 2, 0.44, 1.0, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = 'World'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1348:Expr_L29_C2", "label": "print()", "type": "expression", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1348:FunctionDef_L23_C0", "vector": [8, 1, 0.8788, 0.0303, 1, 0.75, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Hello', name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1348:If_L32_C0", "label": "if", "type": "if", "loc": [32, 33], "level": 0, "parent": null, "vector": [4, 0, 0.9848, 0.0606, 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_1348:Expr_L33_C2", "label": "main()", "type": "expression", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1348:If_L32_C0", "vector": [8, 1, 1.0, 0.0303, 1, 0.31, 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_1348:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1348:If_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1348:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1348:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1348:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1348:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1348:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1348:Expr_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1348:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1348:Expr_L33_C2"}] |
#!/usr/bin/python
# 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/
import sys
import re
import os
import shutil
import commands
"""Copy Special exercise
"""
# +++your code here+++
# Write functions and modify main() to call them
def main():
# This basic command line argument parsing code is provided.
# Add code to call your functions below.
# Make a list of command line arguments, omitting the [0] element
# which is the script itself.
args = sys.argv[1:]
if not args:
print "usage: [--todir dir][--tozip zipfile] dir [dir ...]";
sys.exit(1)
# todir and tozip are either set from command line
# or left as the empty string.
# The args array is left just containing the dirs.
todir = ''
if args[0] == '--todir':
todir = args[1]
del args[0:2]
tozip = ''
if args[0] == '--tozip':
tozip = args[1]
del args[0:2]
if len(args) == 0:
print "error: must specify one or more dirs"
sys.exit(1)
# +++your code here+++
# Call your functions
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_1349 | 21 | 54 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1349:Import_L9_C0", "label": "sys import sys", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0185, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1349:Import_L10_C0", "label": "re import re", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1852, 0.0185, 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_1349:Import_L11_C0", "label": "os import os", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.2037, 0.0185, 0, 0.66, 0.2857, 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_1349:Import_L12_C0", "label": "shutil import shutil", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.2222, 0.0185, 0, 0.66, 0.4286, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "shutil", "arg_names": [], "import_names": ["shutil"], "rhs_call_name": "", "annotation": ""}, "snippet": "import shutil"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1349:Import_L13_C0", "label": "commands import commands", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.2407, 0.0185, 0, 0.66, 0.5714, 760, 0, 1, 0, 0, 760, 0, 0], "semantic": {"name": "commands", "arg_names": [], "import_names": ["commands"], "rhs_call_name": "", "annotation": ""}, "snippet": "import commands"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1349:Expr_L15_C0", "label": "expression", "type": "expression", "loc": [15, 16], "level": 0, "parent": null, "vector": [8, 0, 0.287, 0.037, 0, 0.66, 0.7143, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Copy Special exercise\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1349:FunctionDef_L23_C0", "label": "main", "type": "function", "loc": [23, 48], "level": 0, "parent": null, "vector": [2, 0, 0.6574, 0.4815, 0, 0.66, 0.8571, 624, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n # This basic command line argument parsing code is provided.\n # Add code to call your functions below.\n\n # Make a list of command line arguments, omitting the [0] element\n # which is the script itself.\n args = sys.argv[1:]\n if not args:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1349:Assign_L29_C2", "label": "args =", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1349:FunctionDef_L23_C0", "vector": [14, 1, 0.537, 0.0185, 1, 0.26, 0.0, 805, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = sys.argv[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L30_C2", "label": "if", "type": "if", "loc": [30, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1349:FunctionDef_L23_C0", "vector": [4, 1, 0.5648, 0.037, 1, 0.26, 0.1667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not args:\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1349:Expr_L31_C4", "label": "exit()", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L30_C2", "vector": [8, 2, 0.5741, 0.0185, 2, 0.24, 0.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_1349:Assign_L36_C2", "label": "todir =", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1349:FunctionDef_L23_C0", "vector": [14, 1, 0.6667, 0.0185, 1, 0.26, 0.3333, 823, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "todir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " todir = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L37_C2", "label": "if", "type": "if", "loc": [37, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1349:FunctionDef_L23_C0", "vector": [4, 1, 0.7037, 0.0556, 1, 0.26, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args[0] == '--todir':\n todir = args[1]\n del args[0:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1349:Assign_L38_C4", "label": "todir =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L37_C2", "vector": [14, 2, 0.7037, 0.0185, 2, 0.85, 0.0, 823, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "todir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " todir = args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1349:Assign_L41_C2", "label": "tozip =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1349:FunctionDef_L23_C0", "vector": [14, 1, 0.7593, 0.0185, 1, 0.26, 0.6667, 721, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tozip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tozip = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L42_C2", "label": "if", "type": "if", "loc": [42, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1349:FunctionDef_L23_C0", "vector": [4, 1, 0.7963, 0.0556, 1, 0.26, 0.8333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args[0] == '--tozip':\n tozip = args[1]\n del args[0:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1349:Assign_L43_C4", "label": "tozip =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L42_C2", "vector": [14, 2, 0.7963, 0.0185, 2, 0.12, 0.0, 721, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tozip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tozip = args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L46_C2", "label": "if", "type": "if", "loc": [46, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1349:FunctionDef_L23_C0", "vector": [4, 1, 0.8704, 0.0556, 1, 0.26, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(args) == 0:\n print(\"error: must specify one or more dirs\")\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1349:Expr_L47_C4", "label": "print()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L46_C2", "vector": [8, 2, 0.8704, 0.0185, 2, 0.2, 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: must specify one or more dirs\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1349:Expr_L48_C4", "label": "exit()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L46_C2", "vector": [8, 2, 0.8889, 0.0185, 2, 0.2, 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_1349:If_L53_C0", "label": "if", "type": "if", "loc": [53, 54], "level": 0, "parent": null, "vector": [4, 0, 0.9907, 0.037, 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_1349:Expr_L54_C2", "label": "main()", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L53_C0", "vector": [8, 1, 1.0, 0.0185, 1, 0.85, 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_1349:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1349:Assign_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1349:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1349:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1349:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1349:Assign_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1349:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1349:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1349:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1349:Assign_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1349:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L42_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1349:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1349:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1349:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1349:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1349:If_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1349:Expr_L54_C2"}] |
#!/usr/bin/python
# 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/
import sys
import re
import os
import shutil
import commands
"""Copy Special exercise
"""
# +++your code here+++
# Write functions and modify main() to call them
def main():
# This basic command line argument parsing code is provided.
# Add code to call your functions below.
# Make a list of command line arguments, omitting the [0] element
# which is the script itself.
args = sys.argv[1:]
if not args:
print "usage: [--todir dir][--tozip zipfile] dir [dir ...]";
sys.exit(1)
# todir and tozip are either set from command line
# or left as the empty string.
# The args array is left just containing the dirs.
todir = ''
if args[0] == '--todir':
todir = args[1]
del args[0:2]
tozip = ''
if args[0] == '--tozip':
tozip = args[1]
del args[0:2]
if len(args) == 0:
print "error: must specify one or more dirs"
sys.exit(1)
# +++your code here+++
# Call your functions
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_1350 | 21 | 54 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1350:Import_L9_C0", "label": "sys import sys", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0185, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1350:Import_L10_C0", "label": "re import re", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1852, 0.0185, 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_1350:Import_L11_C0", "label": "os import os", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.2037, 0.0185, 0, 0.66, 0.2857, 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_1350:Import_L12_C0", "label": "shutil import shutil", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.2222, 0.0185, 0, 0.66, 0.4286, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "shutil", "arg_names": [], "import_names": ["shutil"], "rhs_call_name": "", "annotation": ""}, "snippet": "import shutil"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1350:Import_L13_C0", "label": "commands import commands", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.2407, 0.0185, 0, 0.66, 0.5714, 760, 0, 1, 0, 0, 760, 0, 0], "semantic": {"name": "commands", "arg_names": [], "import_names": ["commands"], "rhs_call_name": "", "annotation": ""}, "snippet": "import commands"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1350:Expr_L15_C0", "label": "expression", "type": "expression", "loc": [15, 16], "level": 0, "parent": null, "vector": [8, 0, 0.287, 0.037, 0, 0.66, 0.7143, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Copy Special exercise\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1350:FunctionDef_L23_C0", "label": "main", "type": "function", "loc": [23, 48], "level": 0, "parent": null, "vector": [2, 0, 0.6574, 0.4815, 0, 0.66, 0.8571, 624, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n # This basic command line argument parsing code is provided.\n # Add code to call your functions below.\n\n # Make a list of command line arguments, omitting the [0] element\n # which is the script itself.\n args = sys.argv[1:]\n if not args:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1350:Assign_L29_C2", "label": "args =", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1350:FunctionDef_L23_C0", "vector": [14, 1, 0.537, 0.0185, 1, 0.83, 0.0, 805, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = sys.argv[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L30_C2", "label": "if", "type": "if", "loc": [30, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1350:FunctionDef_L23_C0", "vector": [4, 1, 0.5648, 0.037, 1, 0.83, 0.1667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not args:\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1350:Expr_L31_C4", "label": "exit()", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L30_C2", "vector": [8, 2, 0.5741, 0.0185, 2, 0.46, 0.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_1350:Assign_L36_C2", "label": "todir =", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1350:FunctionDef_L23_C0", "vector": [14, 1, 0.6667, 0.0185, 1, 0.83, 0.3333, 823, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "todir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " todir = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L37_C2", "label": "if", "type": "if", "loc": [37, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1350:FunctionDef_L23_C0", "vector": [4, 1, 0.7037, 0.0556, 1, 0.83, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args[0] == '--todir':\n todir = args[1]\n del args[0:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1350:Assign_L38_C4", "label": "todir =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L37_C2", "vector": [14, 2, 0.7037, 0.0185, 2, 0.17, 0.0, 823, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "todir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " todir = args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1350:Assign_L41_C2", "label": "tozip =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1350:FunctionDef_L23_C0", "vector": [14, 1, 0.7593, 0.0185, 1, 0.83, 0.6667, 721, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tozip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tozip = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L42_C2", "label": "if", "type": "if", "loc": [42, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1350:FunctionDef_L23_C0", "vector": [4, 1, 0.7963, 0.0556, 1, 0.83, 0.8333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args[0] == '--tozip':\n tozip = args[1]\n del args[0:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1350:Assign_L43_C4", "label": "tozip =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L42_C2", "vector": [14, 2, 0.7963, 0.0185, 2, 0.98, 0.0, 721, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tozip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tozip = args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L46_C2", "label": "if", "type": "if", "loc": [46, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1350:FunctionDef_L23_C0", "vector": [4, 1, 0.8704, 0.0556, 1, 0.83, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(args) == 0:\n print(\"error: must specify one or more dirs\")\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1350:Expr_L47_C4", "label": "print()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L46_C2", "vector": [8, 2, 0.8704, 0.0185, 2, 0.61, 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: must specify one or more dirs\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1350:Expr_L48_C4", "label": "exit()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L46_C2", "vector": [8, 2, 0.8889, 0.0185, 2, 0.61, 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_1350:If_L53_C0", "label": "if", "type": "if", "loc": [53, 54], "level": 0, "parent": null, "vector": [4, 0, 0.9907, 0.037, 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_1350:Expr_L54_C2", "label": "main()", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L53_C0", "vector": [8, 1, 1.0, 0.0185, 1, 0.54, 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_1350:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1350:Assign_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1350:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1350:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1350:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1350:Assign_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1350:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1350:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1350:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1350:Assign_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1350:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L42_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1350:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1350:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1350:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1350:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1350:If_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1350:Expr_L54_C2"}] |
#!/usr/bin/python
# 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/
import os
import re
import sys
import urllib
"""Logpuzzle exercise
Given an apache logfile, find the puzzle urls and download the images.
Here's what a puzzle url looks like:
10.254.254.28 - - [06/Aug/2007:00:13:48 -0700] "GET /~foo/puzzle-bar-aaab.jpg HTTP/1.0" 302 528 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"
"""
def read_urls(filename):
"""Returns a list of the puzzle urls from the given log file,
extracting the hostname from the filename itself.
Screens out duplicate urls and returns the urls sorted into
increasing order."""
# +++your code here+++
def download_images(img_urls, dest_dir):
"""Given the urls already in the correct order, downloads
each image into the given directory.
Gives the images local filenames img0, img1, and so on.
Creates an index.html in the directory
with an img tag to show each local image file.
Creates the directory if necessary.
"""
# +++your code here+++
def main():
args = sys.argv[1:]
if not args:
print 'usage: [--todir dir] logfile '
sys.exit(1)
todir = ''
if args[0] == '--todir':
todir = args[1]
del args[0:2]
img_urls = read_urls(args[0])
if todir:
download_images(img_urls, todir)
else:
print '\n'.join(img_urls)
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1351 | 23 | 61 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1351:Import_L9_C0", "label": "os import os", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1475, 0.0164, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1351:Import_L10_C0", "label": "re import re", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1639, 0.0164, 0, 0.66, 0.125, 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_1351:Import_L11_C0", "label": "sys import sys", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1803, 0.0164, 0, 0.66, 0.25, 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_1351:Import_L12_C0", "label": "urllib import urllib", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1967, 0.0164, 0, 0.66, 0.375, 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_1351:Expr_L14_C0", "label": "expression", "type": "expression", "loc": [14, 19], "level": 0, "parent": null, "vector": [8, 0, 0.2705, 0.0984, 0, 0.66, 0.5, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Logpuzzle exercise\nGiven an apache logfile, find the puzzle urls and download the images.\n\nHere's what a puzzle url looks like:\n10.254.254.28 - - [06/Aug/2007:00:13:48 -0700] \"GET /~foo/puzzle-bar-aaab.jpg HTTP/1.0\" 302 528 \"-\" \"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6\"\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1351:FunctionDef_L22_C0", "label": "read_urls", "type": "function", "loc": [22, 26], "level": 0, "parent": null, "vector": [2, 0, 0.3934, 0.082, 0, 0.66, 0.625, 7, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "read_urls", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def read_urls(filename):\n \"\"\"Returns a list of the puzzle urls from the given log file,\n extracting the hostname from the filename itself.\n Screens out duplicate urls and returns the urls sorted into\n increasing order.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1351:Expr_L23_C2", "label": "expression", "type": "expression", "loc": [23, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1351:FunctionDef_L22_C0", "vector": [8, 1, 0.4016, 0.0656, 1, 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 list of the puzzle urls from the given log file,\n extracting the hostname from the filename itself.\n Screens out duplicate urls and returns the urls sorted into\n increasing order.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1351:FunctionDef_L30_C0", "label": "download_images", "type": "function", "loc": [30, 37], "level": 0, "parent": null, "vector": [2, 0, 0.5492, 0.1311, 0, 0.66, 0.75, 106, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "download_images", "arg_names": ["img_urls", "dest_dir"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def download_images(img_urls, dest_dir):\n \"\"\"Given the urls already in the correct order, downloads\n each image into the given directory.\n Gives the images local filenames img0, img1, and so on.\n Creates an index.html in the directory\n with an img tag to show each local image file.\n Creates the directory if necessary.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1351:Expr_L31_C2", "label": "expression", "type": "expression", "loc": [31, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1351:FunctionDef_L30_C0", "vector": [8, 1, 0.5574, 0.1148, 1, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Given the urls already in the correct order, downloads\n each image into the given directory.\n Gives the images local filenames img0, img1, and so on.\n Creates an index.html in the directory\n with an img tag to show each local image file.\n Creates the directory if necessary.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1351:FunctionDef_L41_C0", "label": "main", "type": "function", "loc": [41, 58], "level": 0, "parent": null, "vector": [2, 0, 0.8115, 0.2951, 0, 0.66, 0.875, 624, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n args = sys.argv[1:]\n\n if not args:\n print('usage: [--todir dir] logfile ')\n sys.exit(1)\n\n todir = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1351:Assign_L42_C2", "label": "args =", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1351:FunctionDef_L41_C0", "vector": [14, 1, 0.6885, 0.0164, 1, 0.25, 0.0, 805, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = sys.argv[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1351:If_L44_C2", "label": "if", "type": "if", "loc": [44, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1351:FunctionDef_L41_C0", "vector": [4, 1, 0.7377, 0.0492, 1, 0.25, 0.2, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not args:\n print('usage: [--todir dir] logfile ')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1351:Expr_L45_C4", "label": "print()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1351:If_L44_C2", "vector": [8, 2, 0.7377, 0.0164, 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: [--todir dir] logfile ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1351:Expr_L46_C4", "label": "exit()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1351:If_L44_C2", "vector": [8, 2, 0.7541, 0.0164, 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_1351:Assign_L48_C2", "label": "todir =", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1351:FunctionDef_L41_C0", "vector": [14, 1, 0.7869, 0.0164, 1, 0.25, 0.4, 823, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "todir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " todir = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1351:If_L49_C2", "label": "if", "type": "if", "loc": [49, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1351:FunctionDef_L41_C0", "vector": [4, 1, 0.8197, 0.0492, 1, 0.25, 0.6, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args[0] == '--todir':\n todir = args[1]\n del args[0:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1351:Assign_L50_C4", "label": "todir =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1351:If_L49_C2", "vector": [14, 2, 0.8197, 0.0164, 2, 0.45, 0.0, 823, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "todir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " todir = args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1351:Assign_L53_C2", "label": "img_urls = read_urls()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1351:FunctionDef_L41_C0", "vector": [14, 1, 0.8689, 0.0164, 1, 0.25, 0.8, 27, 3, 1, 0, 0, 7, 10, 1], "semantic": {"name": "img_urls", "arg_names": [], "import_names": [], "rhs_call_name": "read_urls", "annotation": ""}, "snippet": " img_urls = read_urls(args[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1351:If_L55_C2", "label": "if", "type": "if", "loc": [55, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1351:FunctionDef_L41_C0", "vector": [4, 1, 0.9262, 0.0656, 1, 0.25, 1.0, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if todir:\n download_images(img_urls, todir)\n else:\n print('\\n'.join(img_urls))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1351:Expr_L56_C4", "label": "download_images()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1351:If_L55_C2", "vector": [8, 2, 0.918, 0.0164, 2, 0.1, 0.0, 106, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "download_images", "arg_names": [], "import_names": [], "rhs_call_name": "download_images", "annotation": ""}, "snippet": " download_images(img_urls, todir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1351:Expr_L58_C4", "label": "print()", "type": "expression", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1351:If_L55_C2", "vector": [8, 2, 0.9508, 0.0164, 2, 0.1, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\n'.join(img_urls))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1351:If_L60_C0", "label": "if", "type": "if", "loc": [60, 61], "level": 0, "parent": null, "vector": [4, 0, 0.9918, 0.0328, 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_1351:Expr_L61_C2", "label": "main()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1351:If_L60_C0", "vector": [8, 1, 1.0, 0.0164, 1, 0.76, 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_1351:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1351:Expr_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1351:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1351:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1351:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1351:Assign_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1351:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1351:If_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1351:If_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1351:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1351:If_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1351:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1351:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1351:Assign_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1351:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1351:If_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1351:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1351:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1351:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1351:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1351:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1351:If_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1351:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1351:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1351:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1351:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1351:If_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1351:Expr_L61_C2"}] |
#!/usr/bin/python
# 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/
import os
import re
import sys
import urllib
"""Logpuzzle exercise
Given an apache logfile, find the puzzle urls and download the images.
Here's what a puzzle url looks like:
10.254.254.28 - - [06/Aug/2007:00:13:48 -0700] "GET /~foo/puzzle-bar-aaab.jpg HTTP/1.0" 302 528 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"
"""
def read_urls(filename):
"""Returns a list of the puzzle urls from the given log file,
extracting the hostname from the filename itself.
Screens out duplicate urls and returns the urls sorted into
increasing order."""
# +++your code here+++
def download_images(img_urls, dest_dir):
"""Given the urls already in the correct order, downloads
each image into the given directory.
Gives the images local filenames img0, img1, and so on.
Creates an index.html in the directory
with an img tag to show each local image file.
Creates the directory if necessary.
"""
# +++your code here+++
def main():
args = sys.argv[1:]
if not args:
print 'usage: [--todir dir] logfile '
sys.exit(1)
todir = ''
if args[0] == '--todir':
todir = args[1]
del args[0:2]
img_urls = read_urls(args[0])
if todir:
download_images(img_urls, todir)
else:
print '\n'.join(img_urls)
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1352 | 23 | 61 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1352:Import_L9_C0", "label": "os import os", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1475, 0.0164, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1352:Import_L10_C0", "label": "re import re", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1639, 0.0164, 0, 0.66, 0.125, 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_1352:Import_L11_C0", "label": "sys import sys", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1803, 0.0164, 0, 0.66, 0.25, 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_1352:Import_L12_C0", "label": "urllib import urllib", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1967, 0.0164, 0, 0.66, 0.375, 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_1352:Expr_L14_C0", "label": "expression", "type": "expression", "loc": [14, 19], "level": 0, "parent": null, "vector": [8, 0, 0.2705, 0.0984, 0, 0.66, 0.5, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Logpuzzle exercise\nGiven an apache logfile, find the puzzle urls and download the images.\n\nHere's what a puzzle url looks like:\n10.254.254.28 - - [06/Aug/2007:00:13:48 -0700] \"GET /~foo/puzzle-bar-aaab.jpg HTTP/1.0\" 302 528 \"-\" \"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6\"\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1352:FunctionDef_L22_C0", "label": "read_urls", "type": "function", "loc": [22, 26], "level": 0, "parent": null, "vector": [2, 0, 0.3934, 0.082, 0, 0.66, 0.625, 7, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "read_urls", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def read_urls(filename):\n \"\"\"Returns a list of the puzzle urls from the given log file,\n extracting the hostname from the filename itself.\n Screens out duplicate urls and returns the urls sorted into\n increasing order.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1352:Expr_L23_C2", "label": "expression", "type": "expression", "loc": [23, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1352:FunctionDef_L22_C0", "vector": [8, 1, 0.4016, 0.0656, 1, 0.61, 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 puzzle urls from the given log file,\n extracting the hostname from the filename itself.\n Screens out duplicate urls and returns the urls sorted into\n increasing order.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1352:FunctionDef_L30_C0", "label": "download_images", "type": "function", "loc": [30, 37], "level": 0, "parent": null, "vector": [2, 0, 0.5492, 0.1311, 0, 0.66, 0.75, 106, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "download_images", "arg_names": ["img_urls", "dest_dir"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def download_images(img_urls, dest_dir):\n \"\"\"Given the urls already in the correct order, downloads\n each image into the given directory.\n Gives the images local filenames img0, img1, and so on.\n Creates an index.html in the directory\n with an img tag to show each local image file.\n Creates the directory if necessary.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1352:Expr_L31_C2", "label": "expression", "type": "expression", "loc": [31, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1352:FunctionDef_L30_C0", "vector": [8, 1, 0.5574, 0.1148, 1, 0.9, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Given the urls already in the correct order, downloads\n each image into the given directory.\n Gives the images local filenames img0, img1, and so on.\n Creates an index.html in the directory\n with an img tag to show each local image file.\n Creates the directory if necessary.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1352:FunctionDef_L41_C0", "label": "main", "type": "function", "loc": [41, 58], "level": 0, "parent": null, "vector": [2, 0, 0.8115, 0.2951, 0, 0.66, 0.875, 624, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n args = sys.argv[1:]\n\n if not args:\n print('usage: [--todir dir] logfile ')\n sys.exit(1)\n\n todir = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1352:Assign_L42_C2", "label": "args =", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1352:FunctionDef_L41_C0", "vector": [14, 1, 0.6885, 0.0164, 1, 0.71, 0.0, 805, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = sys.argv[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1352:If_L44_C2", "label": "if", "type": "if", "loc": [44, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1352:FunctionDef_L41_C0", "vector": [4, 1, 0.7377, 0.0492, 1, 0.71, 0.2, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not args:\n print('usage: [--todir dir] logfile ')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1352:Expr_L45_C4", "label": "print()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1352:If_L44_C2", "vector": [8, 2, 0.7377, 0.0164, 2, 0.63, 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: [--todir dir] logfile ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1352:Expr_L46_C4", "label": "exit()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1352:If_L44_C2", "vector": [8, 2, 0.7541, 0.0164, 2, 0.63, 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_1352:Assign_L48_C2", "label": "todir =", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1352:FunctionDef_L41_C0", "vector": [14, 1, 0.7869, 0.0164, 1, 0.71, 0.4, 823, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "todir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " todir = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1352:If_L49_C2", "label": "if", "type": "if", "loc": [49, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1352:FunctionDef_L41_C0", "vector": [4, 1, 0.8197, 0.0492, 1, 0.71, 0.6, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args[0] == '--todir':\n todir = args[1]\n del args[0:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1352:Assign_L50_C4", "label": "todir =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1352:If_L49_C2", "vector": [14, 2, 0.8197, 0.0164, 2, 0.27, 0.0, 823, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "todir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " todir = args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1352:Assign_L53_C2", "label": "img_urls = read_urls()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1352:FunctionDef_L41_C0", "vector": [14, 1, 0.8689, 0.0164, 1, 0.71, 0.8, 27, 3, 1, 0, 0, 7, 10, 1], "semantic": {"name": "img_urls", "arg_names": [], "import_names": [], "rhs_call_name": "read_urls", "annotation": ""}, "snippet": " img_urls = read_urls(args[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1352:If_L55_C2", "label": "if", "type": "if", "loc": [55, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1352:FunctionDef_L41_C0", "vector": [4, 1, 0.9262, 0.0656, 1, 0.71, 1.0, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if todir:\n download_images(img_urls, todir)\n else:\n print('\\n'.join(img_urls))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1352:Expr_L56_C4", "label": "download_images()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1352:If_L55_C2", "vector": [8, 2, 0.918, 0.0164, 2, 0.61, 0.0, 106, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "download_images", "arg_names": [], "import_names": [], "rhs_call_name": "download_images", "annotation": ""}, "snippet": " download_images(img_urls, todir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1352:Expr_L58_C4", "label": "print()", "type": "expression", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1352:If_L55_C2", "vector": [8, 2, 0.9508, 0.0164, 2, 0.61, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\n'.join(img_urls))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1352:If_L60_C0", "label": "if", "type": "if", "loc": [60, 61], "level": 0, "parent": null, "vector": [4, 0, 0.9918, 0.0328, 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_1352:Expr_L61_C2", "label": "main()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1352:If_L60_C0", "vector": [8, 1, 1.0, 0.0164, 1, 0.51, 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_1352:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1352:Expr_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1352:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1352:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1352:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1352:Assign_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1352:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1352:If_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1352:If_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1352:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1352:If_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1352:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1352:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1352:Assign_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1352:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1352:If_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1352:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1352:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1352:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1352:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1352:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1352:If_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1352:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1352:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1352:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1352:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1352:If_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1352:Expr_L61_C2"}] |
#!/usr/bin/python -tt
# 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):
array = []
for num in nums:
if num not in array:
array.append(num)
return array
# 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):
array = list1 + list2
return sorted(array)
# 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_1357 | 24 | 50 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L7_C0", "label": "remove_adjacent", "type": "function", "loc": [7, 12], "level": 0, "parent": null, "vector": [2, 0, 0.19, 0.12, 0, 0.66, 0.0, 855, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "remove_adjacent", "arg_names": ["nums"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def remove_adjacent(nums):\n array = []\n for num in nums:\n if num not in array:\n array.append(num)\n return array"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1357:Assign_L8_C2", "label": "array =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L7_C0", "vector": [14, 1, 0.16, 0.02, 1, 0.68, 0.0, 80, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "array", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " array = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1357:For_L9_C2", "label": "for num", "type": "for", "loc": [9, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L7_C0", "vector": [6, 1, 0.2, 0.06, 1, 0.68, 0.5, 328, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for num in nums:\n if num not in array:\n array.append(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1357:If_L10_C4", "label": "if", "type": "if", "loc": [10, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1357:For_L9_C2", "vector": [4, 2, 0.21, 0.04, 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 num not in array:\n array.append(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1357:Expr_L11_C6", "label": "append()", "type": "expression", "loc": [11, 11], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1357:If_L10_C4", "vector": [8, 3, 0.22, 0.02, 3, 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": " array.append(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1357:Return_L12_C2", "label": "return", "type": "return", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L7_C0", "vector": [13, 1, 0.24, 0.02, 1, 0.68, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return array"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L19_C0", "label": "linear_merge", "type": "function", "loc": [19, 21], "level": 0, "parent": null, "vector": [2, 0, 0.4, 0.06, 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 array = list1 + list2\n return sorted(array)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1357:Assign_L20_C2", "label": "array =", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L19_C0", "vector": [14, 1, 0.4, 0.02, 1, 0.48, 0.0, 80, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "array", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " array = list1 + list2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1357:Return_L21_C2", "label": "return", "type": "return", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L19_C0", "vector": [13, 1, 0.42, 0.02, 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 sorted(array)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L26_C0", "label": "test", "type": "function", "loc": [26, 31], "level": 0, "parent": null, "vector": [2, 0, 0.57, 0.12, 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_1357:If_L27_C2", "label": "if", "type": "if", "loc": [27, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L26_C0", "vector": [4, 1, 0.57, 0.08, 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 got == expected:\n prefix = ' OK '\n else:\n prefix = ' X '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1357:Assign_L28_C4", "label": "prefix =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1357:If_L27_C2", "vector": [14, 2, 0.56, 0.02, 2, 0.87, 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_1357:Assign_L30_C4", "label": "prefix =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1357:If_L27_C2", "vector": [14, 2, 0.6, 0.02, 2, 0.87, 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_1357:Expr_L31_C2", "label": "print()", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L26_C0", "vector": [8, 1, 0.62, 0.02, 1, 0.95, 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_1357:FunctionDef_L35_C0", "label": "main", "type": "function", "loc": [35, 46], "level": 0, "parent": null, "vector": [2, 0, 0.81, 0.24, 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_1357:Expr_L36_C2", "label": "print()", "type": "expression", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L35_C0", "vector": [8, 1, 0.72, 0.02, 1, 0.79, 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_1357:Expr_L37_C2", "label": "test()", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L35_C0", "vector": [8, 1, 0.74, 0.02, 1, 0.79, 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_1357:Expr_L38_C2", "label": "test()", "type": "expression", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L35_C0", "vector": [8, 1, 0.76, 0.02, 1, 0.79, 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_1357:Expr_L39_C2", "label": "test()", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L35_C0", "vector": [8, 1, 0.78, 0.02, 1, 0.79, 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_1357:Expr_L41_C2", "label": "test()", "type": "expression", "loc": [41, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L35_C0", "vector": [8, 1, 0.83, 0.04, 1, 0.79, 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_1357:Expr_L43_C2", "label": "test()", "type": "expression", "loc": [43, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L35_C0", "vector": [8, 1, 0.87, 0.04, 1, 0.79, 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_1357:Expr_L45_C2", "label": "test()", "type": "expression", "loc": [45, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L35_C0", "vector": [8, 1, 0.91, 0.04, 1, 0.79, 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_1357:If_L49_C0", "label": "if", "type": "if", "loc": [49, 50], "level": 0, "parent": null, "vector": [4, 0, 0.99, 0.04, 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_1357:Expr_L50_C2", "label": "main()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1357:If_L49_C0", "vector": [8, 1, 1.0, 0.02, 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": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1357:Assign_L8_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1357:For_L9_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1357:For_L9_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1357:If_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1357:If_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1357:Expr_L11_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1357:Return_L12_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1357:Assign_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1357:Return_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1357:If_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1357:If_L27_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1357:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1357:If_L27_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1357:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1357:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1357:Expr_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1357:Expr_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1357:Expr_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1357:Expr_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1357:Expr_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1357:Expr_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1357:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1357:Expr_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1357:If_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1357:Expr_L50_C2"}] |
#!/usr/bin/python -tt
import sys
# 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 word_count_dict(filename):
word_count = {}
my_file = open(filename, 'r')
for line in my_file:
words = line.split()
for word in words:
word = word.lower()
if not word in word_count:
word_count[word] = 1
else:
word_count[word] = word_count[word] + 1
my_file.close()
return word_count
def print_words(filename):
word_count = word_count_dict(filename)
words = sorted(word_count.keys())
for word in words:
print word, word_count[word]
def get_count(word_count_tuple):
return word_count_tuple[1]
def print_top(filename):
word_count = word_count_dict(filename)
items = sorted(word_count.items(), key=get_count, reverse=True)
for item in items[:20]:
print item[0], item[1]
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_1358 | 39 | 64 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1358:Import_L4_C0", "label": "sys import sys", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0156, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L12_C0", "label": "word_count_dict", "type": "function", "loc": [12, 24], "level": 0, "parent": null, "vector": [2, 0, 0.2812, 0.2031, 0, 0.66, 0.1667, 862, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "word_count_dict", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def word_count_dict(filename):\n word_count = {}\n my_file = open(filename, 'r')\n for line in my_file:\n words = line.split()\n for word in words:\n word = word.lower()\n if not word in word_count:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L13_C2", "label": "word_count =", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L12_C0", "vector": [14, 1, 0.2031, 0.0156, 1, 0.24, 0.0, 331, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "word_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " word_count = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L14_C2", "label": "my_file = open()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L12_C0", "vector": [14, 1, 0.2188, 0.0156, 1, 0.24, 0.25, 602, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "my_file", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " my_file = open(filename, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L15_C2", "label": "for line", "type": "for", "loc": [15, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L12_C0", "vector": [6, 1, 0.2891, 0.125, 1, 0.24, 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 my_file:\n words = line.split()\n for word in words:\n word = word.lower()\n if not word in word_count:\n word_count[word] = 1\n else:\n word_count[word] = word_count[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L16_C4", "label": "words = split()", "type": "assigned_variable", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L15_C2", "vector": [14, 2, 0.25, 0.0156, 2, 0.84, 0.0, 376, 3, 0, 0, 0, 908, 10, 1], "semantic": {"name": "words", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " words = line.split()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L17_C4", "label": "for word", "type": "for", "loc": [17, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L15_C2", "vector": [6, 2, 0.3047, 0.0938, 2, 0.84, 1.0, 107, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for word in words:\n word = word.lower()\n if not word in word_count:\n word_count[word] = 1\n else:\n word_count[word] = word_count[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L18_C6", "label": "word = lower()", "type": "assigned_variable", "loc": [18, 18], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L17_C4", "vector": [14, 3, 0.2812, 0.0156, 3, 0.71, 0.0, 107, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " word = word.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L19_C6", "label": "if", "type": "if", "loc": [19, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L17_C4", "vector": [4, 3, 0.3203, 0.0625, 3, 0.71, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not word in word_count:\n word_count[word] = 1\n else:\n word_count[word] = word_count[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L20_C8", "label": "assign", "type": "assigned_variable", "loc": [20, 20], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L19_C6", "vector": [14, 4, 0.3125, 0.0156, 4, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " word_count[word] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L22_C8", "label": "assign", "type": "assigned_variable", "loc": [22, 22], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L19_C6", "vector": [14, 4, 0.3438, 0.0156, 4, 0.7, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " word_count[word] = word_count[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:Expr_L23_C2", "label": "close()", "type": "expression", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L12_C0", "vector": [8, 1, 0.3594, 0.0156, 1, 0.24, 0.75, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " my_file.close() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:Return_L24_C2", "label": "return", "type": "return", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L12_C0", "vector": [13, 1, 0.375, 0.0156, 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 word_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L27_C0", "label": "print_words", "type": "function", "loc": [27, 31], "level": 0, "parent": null, "vector": [2, 0, 0.4531, 0.0781, 0, 0.66, 0.3333, 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 word_count = word_count_dict(filename)\n words = sorted(word_count.keys())\n for word in words:\n print(word, word_count[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L28_C2", "label": "word_count = word_count_dict()", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L27_C0", "vector": [14, 1, 0.4375, 0.0156, 1, 0.45, 0.0, 331, 3, 1, 0, 0, 862, 10, 1], "semantic": {"name": "word_count", "arg_names": [], "import_names": [], "rhs_call_name": "word_count_dict", "annotation": ""}, "snippet": " word_count = word_count_dict(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L29_C2", "label": "words = sorted()", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L27_C0", "vector": [14, 1, 0.4531, 0.0156, 1, 0.45, 0.5, 376, 3, 1, 0, 0, 134, 10, 2], "semantic": {"name": "words", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " words = sorted(word_count.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L30_C2", "label": "for word", "type": "for", "loc": [30, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L27_C0", "vector": [6, 1, 0.4766, 0.0312, 1, 0.45, 1.0, 107, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for word in words:\n print(word, word_count[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:Expr_L31_C4", "label": "print()", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L30_C2", "vector": [8, 2, 0.4844, 0.0156, 2, 0.25, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(word, word_count[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L34_C0", "label": "get_count", "type": "function", "loc": [34, 35], "level": 0, "parent": null, "vector": [2, 0, 0.5391, 0.0312, 0, 0.66, 0.5, 338, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_count", "arg_names": ["word_count_tuple"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_count(word_count_tuple):\n return word_count_tuple[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:Return_L35_C2", "label": "return", "type": "return", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L34_C0", "vector": [13, 1, 0.5469, 0.0156, 1, 0.82, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return word_count_tuple[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L38_C0", "label": "print_top", "type": "function", "loc": [38, 45], "level": 0, "parent": null, "vector": [2, 0, 0.6484, 0.125, 0, 0.66, 0.6667, 148, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "print_top", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_top(filename):\n word_count = word_count_dict(filename)\n\n items = sorted(word_count.items(), key=get_count, reverse=True)\n\n\n for item in items[:20]:\n print(item[0], item[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L39_C2", "label": "word_count = word_count_dict()", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L38_C0", "vector": [14, 1, 0.6094, 0.0156, 1, 0.93, 0.0, 331, 3, 1, 0, 0, 862, 10, 1], "semantic": {"name": "word_count", "arg_names": [], "import_names": [], "rhs_call_name": "word_count_dict", "annotation": ""}, "snippet": " word_count = word_count_dict(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L41_C2", "label": "items = sorted()", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L38_C0", "vector": [14, 1, 0.6406, 0.0156, 1, 0.93, 0.5, 339, 3, 3, 0, 0, 134, 10, 2], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " items = sorted(word_count.items(), key=get_count, reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L44_C2", "label": "for item", "type": "for", "loc": [44, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L38_C0", "vector": [6, 1, 0.6953, 0.0312, 1, 0.93, 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_1358:Expr_L45_C4", "label": "print()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L44_C2", "vector": [8, 2, 0.7031, 0.0156, 2, 0.03, 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_1358:FunctionDef_L48_C0", "label": "main", "type": "function", "loc": [48, 61], "level": 0, "parent": null, "vector": [2, 0, 0.8516, 0.2188, 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_1358:If_L49_C2", "label": "if", "type": "if", "loc": [49, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L48_C0", "vector": [4, 1, 0.7812, 0.0469, 1, 0.19, 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_1358:Expr_L50_C4", "label": "print()", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L49_C2", "vector": [8, 2, 0.7812, 0.0156, 2, 0.86, 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_1358:Expr_L51_C4", "label": "exit()", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L49_C2", "vector": [8, 2, 0.7969, 0.0156, 2, 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_1358:Assign_L53_C2", "label": "option =", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L48_C0", "vector": [14, 1, 0.8281, 0.0156, 1, 0.19, 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_1358:Assign_L54_C2", "label": "filename =", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L48_C0", "vector": [14, 1, 0.8438, 0.0156, 1, 0.19, 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_1358:If_L55_C2", "label": "if", "type": "if", "loc": [55, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L48_C0", "vector": [4, 1, 0.9062, 0.1094, 1, 0.19, 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_1358:Expr_L56_C4", "label": "print_words()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L55_C2", "vector": [8, 2, 0.875, 0.0156, 2, 0.34, 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_1358:If_L57_C2", "label": "if", "type": "if", "loc": [57, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L55_C2", "vector": [4, 2, 0.9219, 0.0781, 2, 0.34, 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_1358:Expr_L58_C4", "label": "print_top()", "type": "expression", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L57_C2", "vector": [8, 3, 0.9062, 0.0156, 3, 0.54, 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_1358:Expr_L60_C4", "label": "print()", "type": "expression", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L57_C2", "vector": [8, 3, 0.9375, 0.0156, 3, 0.54, 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_1358:Expr_L61_C4", "label": "exit()", "type": "expression", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L57_C2", "vector": [8, 3, 0.9531, 0.0156, 3, 0.54, 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_1358:If_L63_C0", "label": "if", "type": "if", "loc": [63, 64], "level": 0, "parent": null, "vector": [4, 0, 0.9922, 0.0312, 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_1358:Expr_L64_C2", "label": "main()", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L63_C0", "vector": [8, 1, 1.0, 0.0156, 1, 0.31, 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_1358:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L13_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L15_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L15_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L15_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L18_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L19_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L19_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L19_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Expr_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Return_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Return_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:For_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Expr_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Assign_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Expr_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1358:If_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1358:Expr_L64_C2"}] |
#!/usr/bin/python -tt
# 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):
array = []
for num in nums:
if num not in array:
array.append(num)
return array
# 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):
array = list1 + list2
return sorted(array)
# 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_1360 | 24 | 50 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L7_C0", "label": "remove_adjacent", "type": "function", "loc": [7, 12], "level": 0, "parent": null, "vector": [2, 0, 0.19, 0.12, 0, 0.66, 0.0, 855, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "remove_adjacent", "arg_names": ["nums"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def remove_adjacent(nums):\n array = []\n for num in nums:\n if num not in array:\n array.append(num)\n return array"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1360:Assign_L8_C2", "label": "array =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L7_C0", "vector": [14, 1, 0.16, 0.02, 1, 0.73, 0.0, 80, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "array", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " array = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1360:For_L9_C2", "label": "for num", "type": "for", "loc": [9, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L7_C0", "vector": [6, 1, 0.2, 0.06, 1, 0.73, 0.5, 328, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for num in nums:\n if num not in array:\n array.append(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1360:If_L10_C4", "label": "if", "type": "if", "loc": [10, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1360:For_L9_C2", "vector": [4, 2, 0.21, 0.04, 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 num not in array:\n array.append(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1360:Expr_L11_C6", "label": "append()", "type": "expression", "loc": [11, 11], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1360:If_L10_C4", "vector": [8, 3, 0.22, 0.02, 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": " array.append(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1360:Return_L12_C2", "label": "return", "type": "return", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L7_C0", "vector": [13, 1, 0.24, 0.02, 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 array"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L19_C0", "label": "linear_merge", "type": "function", "loc": [19, 21], "level": 0, "parent": null, "vector": [2, 0, 0.4, 0.06, 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 array = list1 + list2\n return sorted(array)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1360:Assign_L20_C2", "label": "array =", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L19_C0", "vector": [14, 1, 0.4, 0.02, 1, 0.02, 0.0, 80, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "array", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " array = list1 + list2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1360:Return_L21_C2", "label": "return", "type": "return", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L19_C0", "vector": [13, 1, 0.42, 0.02, 1, 0.02, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sorted(array)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L26_C0", "label": "test", "type": "function", "loc": [26, 31], "level": 0, "parent": null, "vector": [2, 0, 0.57, 0.12, 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_1360:If_L27_C2", "label": "if", "type": "if", "loc": [27, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L26_C0", "vector": [4, 1, 0.57, 0.08, 1, 0.68, 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_1360:Assign_L28_C4", "label": "prefix =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1360:If_L27_C2", "vector": [14, 2, 0.56, 0.02, 2, 0.62, 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_1360:Assign_L30_C4", "label": "prefix =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1360:If_L27_C2", "vector": [14, 2, 0.6, 0.02, 2, 0.62, 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_1360:Expr_L31_C2", "label": "print()", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L26_C0", "vector": [8, 1, 0.62, 0.02, 1, 0.68, 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_1360:FunctionDef_L35_C0", "label": "main", "type": "function", "loc": [35, 46], "level": 0, "parent": null, "vector": [2, 0, 0.81, 0.24, 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_1360:Expr_L36_C2", "label": "print()", "type": "expression", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L35_C0", "vector": [8, 1, 0.72, 0.02, 1, 0.3, 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_1360:Expr_L37_C2", "label": "test()", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L35_C0", "vector": [8, 1, 0.74, 0.02, 1, 0.3, 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_1360:Expr_L38_C2", "label": "test()", "type": "expression", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L35_C0", "vector": [8, 1, 0.76, 0.02, 1, 0.3, 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_1360:Expr_L39_C2", "label": "test()", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L35_C0", "vector": [8, 1, 0.78, 0.02, 1, 0.3, 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_1360:Expr_L41_C2", "label": "test()", "type": "expression", "loc": [41, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L35_C0", "vector": [8, 1, 0.83, 0.04, 1, 0.3, 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_1360:Expr_L43_C2", "label": "test()", "type": "expression", "loc": [43, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L35_C0", "vector": [8, 1, 0.87, 0.04, 1, 0.3, 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_1360:Expr_L45_C2", "label": "test()", "type": "expression", "loc": [45, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L35_C0", "vector": [8, 1, 0.91, 0.04, 1, 0.3, 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_1360:If_L49_C0", "label": "if", "type": "if", "loc": [49, 50], "level": 0, "parent": null, "vector": [4, 0, 0.99, 0.04, 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_1360:Expr_L50_C2", "label": "main()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1360:If_L49_C0", "vector": [8, 1, 1.0, 0.02, 1, 0.34, 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_1360:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1360:Assign_L8_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1360:For_L9_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1360:For_L9_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1360:If_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1360:If_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1360:Expr_L11_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1360:Return_L12_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1360:Assign_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1360:Return_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1360:If_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1360:If_L27_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1360:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1360:If_L27_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1360:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1360:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1360:Expr_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1360:Expr_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1360:Expr_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1360:Expr_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1360:Expr_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1360:Expr_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1360:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1360:Expr_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1360:If_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1360:Expr_L50_C2"}] |
#!/usr/bin/python -tt
import sys
# 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 word_count_dict(filename):
word_count = {}
my_file = open(filename, 'r')
for line in my_file:
words = line.split()
for word in words:
word = word.lower()
if not word in word_count:
word_count[word] = 1
else:
word_count[word] = word_count[word] + 1
my_file.close()
return word_count
def print_words(filename):
word_count = word_count_dict(filename)
words = sorted(word_count.keys())
for word in words:
print word, word_count[word]
def get_count(word_count_tuple):
return word_count_tuple[1]
def print_top(filename):
word_count = word_count_dict(filename)
items = sorted(word_count.items(), key=get_count, reverse=True)
for item in items[:20]:
print item[0], item[1]
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_1361 | 39 | 64 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1361:Import_L4_C0", "label": "sys import sys", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0156, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L12_C0", "label": "word_count_dict", "type": "function", "loc": [12, 24], "level": 0, "parent": null, "vector": [2, 0, 0.2812, 0.2031, 0, 0.66, 0.1667, 862, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "word_count_dict", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def word_count_dict(filename):\n word_count = {}\n my_file = open(filename, 'r')\n for line in my_file:\n words = line.split()\n for word in words:\n word = word.lower()\n if not word in word_count:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L13_C2", "label": "word_count =", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L12_C0", "vector": [14, 1, 0.2031, 0.0156, 1, 0.66, 0.0, 331, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "word_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " word_count = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L14_C2", "label": "my_file = open()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L12_C0", "vector": [14, 1, 0.2188, 0.0156, 1, 0.66, 0.25, 602, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "my_file", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " my_file = open(filename, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L15_C2", "label": "for line", "type": "for", "loc": [15, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L12_C0", "vector": [6, 1, 0.2891, 0.125, 1, 0.66, 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 my_file:\n words = line.split()\n for word in words:\n word = word.lower()\n if not word in word_count:\n word_count[word] = 1\n else:\n word_count[word] = word_count[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L16_C4", "label": "words = split()", "type": "assigned_variable", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L15_C2", "vector": [14, 2, 0.25, 0.0156, 2, 0.69, 0.0, 376, 3, 0, 0, 0, 908, 10, 1], "semantic": {"name": "words", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " words = line.split()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L17_C4", "label": "for word", "type": "for", "loc": [17, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L15_C2", "vector": [6, 2, 0.3047, 0.0938, 2, 0.69, 1.0, 107, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for word in words:\n word = word.lower()\n if not word in word_count:\n word_count[word] = 1\n else:\n word_count[word] = word_count[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L18_C6", "label": "word = lower()", "type": "assigned_variable", "loc": [18, 18], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L17_C4", "vector": [14, 3, 0.2812, 0.0156, 3, 0.02, 0.0, 107, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " word = word.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L19_C6", "label": "if", "type": "if", "loc": [19, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L17_C4", "vector": [4, 3, 0.3203, 0.0625, 3, 0.02, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not word in word_count:\n word_count[word] = 1\n else:\n word_count[word] = word_count[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L20_C8", "label": "assign", "type": "assigned_variable", "loc": [20, 20], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L19_C6", "vector": [14, 4, 0.3125, 0.0156, 4, 0.9, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " word_count[word] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L22_C8", "label": "assign", "type": "assigned_variable", "loc": [22, 22], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L19_C6", "vector": [14, 4, 0.3438, 0.0156, 4, 0.9, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " word_count[word] = word_count[word] + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:Expr_L23_C2", "label": "close()", "type": "expression", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L12_C0", "vector": [8, 1, 0.3594, 0.0156, 1, 0.66, 0.75, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " my_file.close() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:Return_L24_C2", "label": "return", "type": "return", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L12_C0", "vector": [13, 1, 0.375, 0.0156, 1, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return word_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L27_C0", "label": "print_words", "type": "function", "loc": [27, 31], "level": 0, "parent": null, "vector": [2, 0, 0.4531, 0.0781, 0, 0.66, 0.3333, 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 word_count = word_count_dict(filename)\n words = sorted(word_count.keys())\n for word in words:\n print(word, word_count[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L28_C2", "label": "word_count = word_count_dict()", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L27_C0", "vector": [14, 1, 0.4375, 0.0156, 1, 0.22, 0.0, 331, 3, 1, 0, 0, 862, 10, 1], "semantic": {"name": "word_count", "arg_names": [], "import_names": [], "rhs_call_name": "word_count_dict", "annotation": ""}, "snippet": " word_count = word_count_dict(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L29_C2", "label": "words = sorted()", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L27_C0", "vector": [14, 1, 0.4531, 0.0156, 1, 0.22, 0.5, 376, 3, 1, 0, 0, 134, 10, 2], "semantic": {"name": "words", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " words = sorted(word_count.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L30_C2", "label": "for word", "type": "for", "loc": [30, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L27_C0", "vector": [6, 1, 0.4766, 0.0312, 1, 0.22, 1.0, 107, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for word in words:\n print(word, word_count[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:Expr_L31_C4", "label": "print()", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L30_C2", "vector": [8, 2, 0.4844, 0.0156, 2, 0.65, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(word, word_count[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L34_C0", "label": "get_count", "type": "function", "loc": [34, 35], "level": 0, "parent": null, "vector": [2, 0, 0.5391, 0.0312, 0, 0.66, 0.5, 338, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_count", "arg_names": ["word_count_tuple"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_count(word_count_tuple):\n return word_count_tuple[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:Return_L35_C2", "label": "return", "type": "return", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L34_C0", "vector": [13, 1, 0.5469, 0.0156, 1, 0.45, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return word_count_tuple[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L38_C0", "label": "print_top", "type": "function", "loc": [38, 45], "level": 0, "parent": null, "vector": [2, 0, 0.6484, 0.125, 0, 0.66, 0.6667, 148, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "print_top", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_top(filename):\n word_count = word_count_dict(filename)\n\n items = sorted(word_count.items(), key=get_count, reverse=True)\n\n\n for item in items[:20]:\n print(item[0], item[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L39_C2", "label": "word_count = word_count_dict()", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L38_C0", "vector": [14, 1, 0.6094, 0.0156, 1, 0.8, 0.0, 331, 3, 1, 0, 0, 862, 10, 1], "semantic": {"name": "word_count", "arg_names": [], "import_names": [], "rhs_call_name": "word_count_dict", "annotation": ""}, "snippet": " word_count = word_count_dict(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L41_C2", "label": "items = sorted()", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L38_C0", "vector": [14, 1, 0.6406, 0.0156, 1, 0.8, 0.5, 339, 3, 3, 0, 0, 134, 10, 2], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " items = sorted(word_count.items(), key=get_count, reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L44_C2", "label": "for item", "type": "for", "loc": [44, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L38_C0", "vector": [6, 1, 0.6953, 0.0312, 1, 0.8, 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_1361:Expr_L45_C4", "label": "print()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L44_C2", "vector": [8, 2, 0.7031, 0.0156, 2, 0.82, 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_1361:FunctionDef_L48_C0", "label": "main", "type": "function", "loc": [48, 61], "level": 0, "parent": null, "vector": [2, 0, 0.8516, 0.2188, 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_1361:If_L49_C2", "label": "if", "type": "if", "loc": [49, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L48_C0", "vector": [4, 1, 0.7812, 0.0469, 1, 0.77, 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_1361:Expr_L50_C4", "label": "print()", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L49_C2", "vector": [8, 2, 0.7812, 0.0156, 2, 0.88, 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_1361:Expr_L51_C4", "label": "exit()", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L49_C2", "vector": [8, 2, 0.7969, 0.0156, 2, 0.88, 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_1361:Assign_L53_C2", "label": "option =", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L48_C0", "vector": [14, 1, 0.8281, 0.0156, 1, 0.77, 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_1361:Assign_L54_C2", "label": "filename =", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L48_C0", "vector": [14, 1, 0.8438, 0.0156, 1, 0.77, 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_1361:If_L55_C2", "label": "if", "type": "if", "loc": [55, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L48_C0", "vector": [4, 1, 0.9062, 0.1094, 1, 0.77, 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_1361:Expr_L56_C4", "label": "print_words()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L55_C2", "vector": [8, 2, 0.875, 0.0156, 2, 0.14, 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_1361:If_L57_C2", "label": "if", "type": "if", "loc": [57, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L55_C2", "vector": [4, 2, 0.9219, 0.0781, 2, 0.14, 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_1361:Expr_L58_C4", "label": "print_top()", "type": "expression", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L57_C2", "vector": [8, 3, 0.9062, 0.0156, 3, 0.26, 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_1361:Expr_L60_C4", "label": "print()", "type": "expression", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L57_C2", "vector": [8, 3, 0.9375, 0.0156, 3, 0.26, 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_1361:Expr_L61_C4", "label": "exit()", "type": "expression", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L57_C2", "vector": [8, 3, 0.9531, 0.0156, 3, 0.26, 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_1361:If_L63_C0", "label": "if", "type": "if", "loc": [63, 64], "level": 0, "parent": null, "vector": [4, 0, 0.9922, 0.0312, 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_1361:Expr_L64_C2", "label": "main()", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L63_C0", "vector": [8, 1, 1.0, 0.0156, 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": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L13_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L15_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L15_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L15_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L18_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L19_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L19_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L19_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Expr_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Return_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Return_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:For_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Expr_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Assign_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Expr_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1361:If_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1361:Expr_L64_C2"}] |
#!/usr/bin/env python
# -*- encoding:utf8 -*-
# protoc-gen-erl
# Google's Protocol Buffers project, ported to lua.
# https://code.google.com/p/protoc-gen-lua/
#
# Copyright (c) 2010 , 林卓毅 (Zhuoyi Lin) netsnail@gmail.com
# All rights reserved.
#
# Use, modification and distribution are subject to the "New BSD License"
# as listed at <url: http://www.opensource.org/licenses/bsd-license.php >.
import sys
import os.path as path
from cStringIO import StringIO
import plugin_pb2
import google.protobuf.descriptor_pb2 as descriptor_pb2
_packages = {}
_files = {}
_message = {}
FDP = plugin_pb2.descriptor_pb2.FieldDescriptorProto
if sys.platform == "win32":
import msvcrt, os
msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
class CppType:
CPPTYPE_INT32 = 1
CPPTYPE_INT64 = 2
CPPTYPE_UINT32 = 3
CPPTYPE_UINT64 = 4
CPPTYPE_DOUBLE = 5
CPPTYPE_FLOAT = 6
CPPTYPE_BOOL = 7
CPPTYPE_ENUM = 8
CPPTYPE_STRING = 9
CPPTYPE_MESSAGE = 10
CPP_TYPE ={
FDP.TYPE_DOUBLE : CppType.CPPTYPE_DOUBLE,
FDP.TYPE_FLOAT : CppType.CPPTYPE_FLOAT,
FDP.TYPE_INT64 : CppType.CPPTYPE_INT64,
FDP.TYPE_UINT64 : CppType.CPPTYPE_UINT64,
FDP.TYPE_INT32 : CppType.CPPTYPE_INT32,
FDP.TYPE_FIXED64 : CppType.CPPTYPE_UINT64,
FDP.TYPE_FIXED32 : CppType.CPPTYPE_UINT32,
FDP.TYPE_BOOL : CppType.CPPTYPE_BOOL,
FDP.TYPE_STRING : CppType.CPPTYPE_STRING,
FDP.TYPE_MESSAGE : CppType.CPPTYPE_MESSAGE,
FDP.TYPE_BYTES : CppType.CPPTYPE_STRING,
FDP.TYPE_UINT32 : CppType.CPPTYPE_UINT32,
FDP.TYPE_ENUM : CppType.CPPTYPE_ENUM,
FDP.TYPE_SFIXED32 : CppType.CPPTYPE_INT32,
FDP.TYPE_SFIXED64 : CppType.CPPTYPE_INT64,
FDP.TYPE_SINT32 : CppType.CPPTYPE_INT32,
FDP.TYPE_SINT64 : CppType.CPPTYPE_INT64
}
def printerr(*args):
sys.stderr.write(" ".join(args))
sys.stderr.write("\n")
sys.stderr.flush()
class TreeNode(object):
def __init__(self, name, parent=None, filename=None, package=None):
super(TreeNode, self).__init__()
self.child = []
self.parent = parent
self.filename = filename
self.package = package
if parent:
self.parent.add_child(self)
self.name = name
def add_child(self, child):
self.child.append(child)
def find_child(self, child_names):
if child_names:
for i in self.child:
if i.name == child_names[0]:
return i.find_child(child_names[1:])
raise StandardError
else:
return self
def get_child(self, child_name):
for i in self.child:
if i.name == child_name:
return i
return None
def get_path(self, end = None):
pos = self
out = []
while pos and pos != end:
out.append(pos.name)
pos = pos.parent
out.reverse()
return '.'.join(out)
def get_global_name(self):
return self.get_path()
def get_local_name(self):
pos = self
while pos.parent:
pos = pos.parent
if self.package and pos.name == self.package[-1]:
break
return self.get_path(pos)
def __str__(self):
return self.to_string(0)
def __repr__(self):
return str(self)
def to_string(self, indent = 0):
return ' '*indent + '<TreeNode ' + self.name + '(\n' + \
','.join([i.to_string(indent + 4) for i in self.child]) + \
' '*indent +')>\n'
class Env(object):
filename = None
package = None
extend = None
descriptor = None
message = None
context = None
register = None
def __init__(self):
self.message_tree = TreeNode('')
self.scope = self.message_tree
def get_global_name(self):
return self.scope.get_global_name()
def get_local_name(self):
return self.scope.get_local_name()
def get_ref_name(self, type_name):
try:
node = self.lookup_name(type_name)
except:
# if the child doesn't be founded, it must be in this file
return type_name[len('.'.join(self.package)) + 2:]
if node.filename != self.filename:
return node.filename + '_pb.' + node.get_local_name()
return node.get_local_name()
def lookup_name(self, name):
names = name.split('.')
if names[0] == '':
return self.message_tree.find_child(names[1:])
else:
return self.scope.parent.find_child(names)
def enter_package(self, package):
if not package:
return self.message_tree
names = package.split('.')
pos = self.message_tree
for i, name in enumerate(names):
new_pos = pos.get_child(name)
if new_pos:
pos = new_pos
else:
return self._build_nodes(pos, names[i:])
return pos
def enter_file(self, filename, package):
self.filename = filename
self.package = package.split('.')
self._init_field()
self.scope = self.enter_package(package)
def exit_file(self):
self._init_field()
self.filename = None
self.package = []
self.scope = self.scope.parent
def enter(self, message_name):
self.scope = TreeNode(message_name, self.scope, self.filename,
self.package)
def exit(self):
self.scope = self.scope.parent
def _init_field(self):
self.descriptor = []
self.context = []
self.message = []
self.register = []
def _build_nodes(self, node, names):
parent = node
for i in names:
parent = TreeNode(i, parent, self.filename, self.package)
return parent
class Writer(object):
def __init__(self, prefix=None):
self.io = StringIO()
self.__indent = ''
self.__prefix = prefix
def getvalue(self):
return self.io.getvalue()
def __enter__(self):
self.__indent += ' '
return self
def __exit__(self, type, value, trackback):
self.__indent = self.__indent[:-4]
def __call__(self, data):
self.io.write(self.__indent)
if self.__prefix:
self.io.write(self.__prefix)
self.io.write(data)
DEFAULT_VALUE = {
FDP.TYPE_DOUBLE : '0.0',
FDP.TYPE_FLOAT : '0.0',
FDP.TYPE_INT64 : '0',
FDP.TYPE_UINT64 : '0',
FDP.TYPE_INT32 : '0',
FDP.TYPE_FIXED64 : '0',
FDP.TYPE_FIXED32 : '0',
FDP.TYPE_BOOL : 'false',
FDP.TYPE_STRING : '""',
FDP.TYPE_MESSAGE : 'nil',
FDP.TYPE_BYTES : '""',
FDP.TYPE_UINT32 : '0',
FDP.TYPE_ENUM : '1',
FDP.TYPE_SFIXED32 : '0',
FDP.TYPE_SFIXED64 : '0',
FDP.TYPE_SINT32 : '0',
FDP.TYPE_SINT64 : '0',
}
def code_gen_enum_item(index, enum_value, env):
full_name = env.get_local_name() + '.' + enum_value.name
obj_name = full_name.upper().replace('.', '_') + '_ENUM'
env.descriptor.append(
"local %s = protobuf.EnumValueDescriptor();\n"% obj_name
)
context = Writer(obj_name)
context('.name = "%s"\n' % enum_value.name)
context('.index = %d\n' % index)
context('.number = %d\n' % enum_value.number)
env.context.append(context.getvalue())
return obj_name
def code_gen_enum(enum_desc, env):
env.enter(enum_desc.name)
full_name = env.get_local_name()
obj_name = full_name.upper().replace('.', '_')
env.descriptor.append(
"local %s = protobuf.EnumDescriptor();\n"% obj_name
)
context = Writer(obj_name)
context('.name = "%s"\n' % enum_desc.name)
context('.full_name = "%s"\n' % env.get_global_name())
values = []
for i, enum_value in enumerate(enum_desc.value):
values.append(code_gen_enum_item(i, enum_value, env))
context('.values = {%s}\n' % ','.join(values))
env.context.append(context.getvalue())
env.exit()
return obj_name
def code_gen_field(index, field_desc, env):
full_name = env.get_local_name() + '.' + field_desc.name
obj_name = full_name.upper().replace('.', '_') + '_FIELD'
env.descriptor.append(
"local %s = protobuf.FieldDescriptor();\n"% obj_name
)
context = Writer(obj_name)
context('.name = "%s"\n' % field_desc.name)
context('.full_name = "%s"\n' % (
env.get_global_name() + '.' + field_desc.name))
context('.number = %d\n' % field_desc.number)
context('.index = %d\n' % index)
context('.label = %d\n' % field_desc.label)
if field_desc.HasField("default_value"):
context('.has_default_value = true\n')
value = field_desc.default_value
if field_desc.type == FDP.TYPE_STRING:
context('.default_value = "%s"\n'%value)
else:
context('.default_value = %s\n'%value)
else:
context('.has_default_value = false\n')
if field_desc.label == FDP.LABEL_REPEATED:
default_value = "{}"
elif field_desc.HasField('type_name'):
default_value = "nil"
else:
default_value = DEFAULT_VALUE[field_desc.type]
context('.default_value = %s\n' % default_value)
if field_desc.HasField('type_name'):
type_name = env.get_ref_name(field_desc.type_name).upper().replace('.', '_')
if field_desc.type == FDP.TYPE_MESSAGE:
context('.message_type = %s\n' % type_name)
else:
context('.enum_type = %s\n' % type_name)
if field_desc.HasField('extendee'):
type_name = env.get_ref_name(field_desc.extendee)
env.register.append(
"%s.RegisterExtension(%s)\n" % (type_name, obj_name)
)
context('.type = %d\n' % field_desc.type)
context('.cpp_type = %d\n\n' % CPP_TYPE[field_desc.type])
env.context.append(context.getvalue())
return obj_name
def code_gen_message(message_descriptor, env, containing_type = None):
env.enter(message_descriptor.name)
full_name = env.get_local_name()
obj_name = full_name.upper().replace('.', '_')
env.descriptor.append(
"local %s = protobuf.Descriptor();\n"% obj_name
)
context = Writer(obj_name)
context('.name = "%s"\n' % message_descriptor.name)
context('.full_name = "%s"\n' % env.get_global_name())
nested_types = []
for msg_desc in message_descriptor.nested_type:
msg_name = code_gen_message(msg_desc, env, obj_name)
nested_types.append(msg_name)
context('.nested_types = {%s}\n' % ', '.join(nested_types))
enums = []
for enum_desc in message_descriptor.enum_type:
enums.append(code_gen_enum(enum_desc, env))
context('.enum_types = {%s}\n' % ', '.join(enums))
fields = []
for i, field_desc in enumerate(message_descriptor.field):
fields.append(code_gen_field(i, field_desc, env))
context('.fields = {%s}\n' % ', '.join(fields))
if len(message_descriptor.extension_range) > 0:
context('.is_extendable = true\n')
else:
context('.is_extendable = false\n')
extensions = []
for i, field_desc in enumerate(message_descriptor.extension):
extensions.append(code_gen_field(i, field_desc, env))
context('.extensions = {%s}\n' % ', '.join(extensions))
if containing_type:
context('.containing_type = %s\n' % containing_type)
env.message.append('%s = protobuf.Message(%s)\n' % (full_name,
obj_name))
env.context.append(context.getvalue())
env.exit()
return obj_name
def write_header(writer):
writer("""-- Generated By protoc-gen-lua Do not Edit
""")
def code_gen_file(proto_file, env, is_gen):
filename = path.splitext(proto_file.name)[0]
env.enter_file(filename, proto_file.package)
includes = []
for f in proto_file.dependency:
inc_file = path.splitext(f)[0]
includes.append(inc_file)
# for field_desc in proto_file.extension:
# code_gen_extensions(field_desc, field_desc.name, env)
for enum_desc in proto_file.enum_type:
code_gen_enum(enum_desc, env)
for enum_value in enum_desc.value:
env.message.append('%s = %d\n' % (enum_value.name,
enum_value.number))
for msg_desc in proto_file.message_type:
code_gen_message(msg_desc, env)
if is_gen:
lua = Writer()
write_header(lua)
lua('local protobuf = require "protobuf"\n')
for i in includes:
lua('local %s_pb = require("%s_pb")\n' % (i, i))
lua("module('%s_pb')\n" % env.filename)
lua('\n\n')
map(lua, env.descriptor)
lua('\n')
map(lua, env.context)
lua('\n')
env.message.sort()
map(lua, env.message)
lua('\n')
map(lua, env.register)
_files[env.filename+ '_pb.lua'] = lua.getvalue()
env.exit_file()
def main():
plugin_require_bin = sys.stdin.read()
code_gen_req = plugin_pb2.CodeGeneratorRequest()
code_gen_req.ParseFromString(plugin_require_bin)
env = Env()
for proto_file in code_gen_req.proto_file:
code_gen_file(proto_file, env,
proto_file.name in code_gen_req.file_to_generate)
code_generated = plugin_pb2.CodeGeneratorResponse()
for k in _files:
file_desc = code_generated.file.add()
file_desc.name = k
file_desc.content = _files[k]
sys.stdout.write(code_generated.SerializeToString())
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_1363 | 295 | 450 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Import_L13_C0", "label": "sys import sys", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0289, 0.0022, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Import_L14_C0", "label": "os.path import path", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0311, 0.0022, 0, 0.66, 0.0417, 79, 0, 1, 0, 0, 79, 0, 0], "semantic": {"name": "os.path", "arg_names": [], "import_names": ["path"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os.path as path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:ImportFrom_L15_C0", "label": "from cStringIO import StringIO", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0333, 0.0022, 0, 0.66, 0.0833, 764, 0, 1, 0, 0, 764, 0, 0], "semantic": {"name": "cStringIO", "arg_names": [], "import_names": ["StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": "from cStringIO import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Import_L17_C0", "label": "plugin_pb2 import plugin_pb2", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0378, 0.0022, 0, 0.66, 0.125, 5, 0, 1, 0, 0, 5, 0, 0], "semantic": {"name": "plugin_pb2", "arg_names": [], "import_names": ["plugin_pb2"], "rhs_call_name": "", "annotation": ""}, "snippet": "import plugin_pb2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Import_L18_C0", "label": "google.protobuf.descriptor_pb2 import descriptor_pb2", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.04, 0.0022, 0, 0.66, 0.1667, 35, 0, 1, 0, 0, 35, 0, 0], "semantic": {"name": "google.protobuf.descriptor_pb2", "arg_names": [], "import_names": ["descriptor_pb2"], "rhs_call_name": "", "annotation": ""}, "snippet": "import google.protobuf.descriptor_pb2 as descriptor_pb2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L20_C0", "label": "_packages =", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.0444, 0.0022, 0, 0.66, 0.2083, 932, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_packages", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_packages = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L21_C0", "label": "_files =", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.0467, 0.0022, 0, 0.66, 0.25, 743, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_files = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L22_C0", "label": "_message =", "type": "assigned_variable", "loc": [22, 22], "level": 0, "parent": null, "vector": [14, 0, 0.0489, 0.0022, 0, 0.66, 0.2917, 839, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_message = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L24_C0", "label": "FDP =", "type": "assigned_variable", "loc": [24, 24], "level": 0, "parent": null, "vector": [14, 0, 0.0533, 0.0022, 0, 0.66, 0.3333, 454, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "FDP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "FDP = plugin_pb2.descriptor_pb2.FieldDescriptorProto"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L26_C0", "label": "if", "type": "if", "loc": [26, 29], "level": 0, "parent": null, "vector": [4, 0, 0.0611, 0.0089, 0, 0.66, 0.375, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if sys.platform == \"win32\":\n import msvcrt, os\n msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)\n msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Import_L27_C4", "label": "msvcrt import msvcrt, os", "type": "import", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L26_C0", "vector": [1, 1, 0.06, 0.0022, 1, 0.32, 0.0, 521, 0, 2, 0, 0, 521, 0, 0], "semantic": {"name": "msvcrt", "arg_names": [], "import_names": ["msvcrt", "os"], "rhs_call_name": "", "annotation": ""}, "snippet": " import msvcrt, os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L28_C4", "label": "setmode()", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L26_C0", "vector": [8, 1, 0.0622, 0.0022, 1, 0.32, 0.5, 464, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "setmode", "arg_names": [], "import_names": [], "rhs_call_name": "setmode", "annotation": ""}, "snippet": " msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L29_C4", "label": "setmode()", "type": "expression", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L26_C0", "vector": [8, 1, 0.0644, 0.0022, 1, 0.32, 1.0, 464, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "setmode", "arg_names": [], "import_names": [], "rhs_call_name": "setmode", "annotation": ""}, "snippet": " msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "label": "CppType", "type": "class", "loc": [31, 41], "level": 0, "parent": null, "vector": [3, 0, 0.08, 0.0244, 0, 0.66, 0.4167, 637, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "CppType", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CppType:\n CPPTYPE_INT32 = 1\n CPPTYPE_INT64 = 2\n CPPTYPE_UINT32 = 3\n CPPTYPE_UINT64 = 4\n CPPTYPE_DOUBLE = 5\n CPPTYPE_FLOAT = 6\n CPPTYPE_BOOL = 7"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L32_C4", "label": "CPPTYPE_INT32 =", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "vector": [14, 1, 0.0711, 0.0022, 1, 0.0, 0.0, 90, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "CPPTYPE_INT32", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CPPTYPE_INT32 = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L33_C4", "label": "CPPTYPE_INT64 =", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "vector": [14, 1, 0.0733, 0.0022, 1, 0.0, 0.1111, 114, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "CPPTYPE_INT64", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CPPTYPE_INT64 = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L34_C4", "label": "CPPTYPE_UINT32 =", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "vector": [14, 1, 0.0756, 0.0022, 1, 0.0, 0.2222, 927, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "CPPTYPE_UINT32", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CPPTYPE_UINT32 = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L35_C4", "label": "CPPTYPE_UINT64 =", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "vector": [14, 1, 0.0778, 0.0022, 1, 0.0, 0.3333, 204, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "CPPTYPE_UINT64", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CPPTYPE_UINT64 = 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L36_C4", "label": "CPPTYPE_DOUBLE =", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "vector": [14, 1, 0.08, 0.0022, 1, 0.0, 0.4444, 558, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "CPPTYPE_DOUBLE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CPPTYPE_DOUBLE = 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L37_C4", "label": "CPPTYPE_FLOAT =", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "vector": [14, 1, 0.0822, 0.0022, 1, 0.0, 0.5556, 641, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "CPPTYPE_FLOAT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CPPTYPE_FLOAT = 6"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L38_C4", "label": "CPPTYPE_BOOL =", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "vector": [14, 1, 0.0844, 0.0022, 1, 0.0, 0.6667, 894, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "CPPTYPE_BOOL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CPPTYPE_BOOL = 7"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L39_C4", "label": "CPPTYPE_ENUM =", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "vector": [14, 1, 0.0867, 0.0022, 1, 0.0, 0.7778, 180, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "CPPTYPE_ENUM", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CPPTYPE_ENUM = 8"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L40_C4", "label": "CPPTYPE_STRING =", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "vector": [14, 1, 0.0889, 0.0022, 1, 0.0, 0.8889, 180, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "CPPTYPE_STRING", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CPPTYPE_STRING = 9"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L41_C4", "label": "CPPTYPE_MESSAGE =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "vector": [14, 1, 0.0911, 0.0022, 1, 0.0, 1.0, 991, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "CPPTYPE_MESSAGE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CPPTYPE_MESSAGE = 10"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L43_C0", "label": "CPP_TYPE =", "type": "assigned_variable", "loc": [43, 61], "level": 0, "parent": null, "vector": [14, 0, 0.1156, 0.0422, 0, 0.66, 0.4583, 37, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "CPP_TYPE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "CPP_TYPE ={\n FDP.TYPE_DOUBLE : CppType.CPPTYPE_DOUBLE,\n FDP.TYPE_FLOAT : CppType.CPPTYPE_FLOAT,\n FDP.TYPE_INT64 : CppType.CPPTYPE_INT64,\n FDP.TYPE_UINT64 : CppType.CPPTYPE_UINT64,\n FDP.TYPE_INT32 : CppType.CPPTYPE_INT32,\n FDP.TYPE_FIXED64 : CppType.CPPTYPE_UINT64,\n FDP.TYPE_FIXED32 : CppType.CPPTYPE_UINT32,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L63_C0", "label": "printerr", "type": "function", "loc": [63, 66], "level": 0, "parent": null, "vector": [2, 0, 0.1433, 0.0089, 0, 0.66, 0.5, 929, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "printerr", "arg_names": ["args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def printerr(*args):\n sys.stderr.write(\" \".join(args))\n sys.stderr.write(\"\\n\")\n sys.stderr.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L64_C4", "label": "write()", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L63_C0", "vector": [8, 1, 0.1422, 0.0022, 1, 0.3, 0.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " sys.stderr.write(\" \".join(args))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L65_C4", "label": "write()", "type": "expression", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L63_C0", "vector": [8, 1, 0.1444, 0.0022, 1, 0.3, 0.5, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " sys.stderr.write(\"\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L66_C4", "label": "flush()", "type": "expression", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L63_C0", "vector": [8, 1, 0.1467, 0.0022, 1, 0.3, 1.0, 439, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "flush", "arg_names": [], "import_names": [], "rhs_call_name": "flush", "annotation": ""}, "snippet": " sys.stderr.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "label": "TreeNode", "type": "class", "loc": [68, 126], "level": 0, "parent": null, "vector": [3, 0, 0.2156, 0.1311, 0, 0.66, 0.5417, 30, 0, 10, 0, 0, 186, 0, 14], "semantic": {"name": "TreeNode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TreeNode(object):\n def __init__(self, name, parent=None, filename=None, package=None):\n super(TreeNode, self).__init__()\n self.child = []\n self.parent = parent\n self.filename = filename\n self.package = package\n if parent:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L69_C4", "label": "__init__", "type": "function", "loc": [69, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "vector": [2, 1, 0.1622, 0.02, 1, 0.59, 0.0, 555, 0, 5, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "name", "parent", "filename", "package"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, parent=None, filename=None, package=None):\n super(TreeNode, self).__init__()\n self.child = []\n self.parent = parent\n self.filename = filename\n self.package = package\n if parent:\n self.parent.add_child(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L70_C8", "label": "__init__()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L69_C4", "vector": [8, 2, 0.1556, 0.0022, 2, 0.58, 0.0, 555, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(TreeNode, self).__init__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L71_C8", "label": "self.child =", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L69_C4", "vector": [14, 2, 0.1578, 0.0022, 2, 0.58, 0.1667, 125, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.child", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.child = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L72_C8", "label": "self.parent =", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L69_C4", "vector": [14, 2, 0.16, 0.0022, 2, 0.58, 0.3333, 428, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.parent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.parent = parent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L73_C8", "label": "self.filename =", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L69_C4", "vector": [14, 2, 0.1622, 0.0022, 2, 0.58, 0.5, 942, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.filename = filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L74_C8", "label": "self.package =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L69_C4", "vector": [14, 2, 0.1644, 0.0022, 2, 0.58, 0.6667, 544, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.package", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.package = package"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L75_C8", "label": "if", "type": "if", "loc": [75, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L69_C4", "vector": [4, 2, 0.1678, 0.0044, 2, 0.58, 0.8333, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parent:\n self.parent.add_child(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L76_C12", "label": "add_child()", "type": "expression", "loc": [76, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L75_C8", "vector": [8, 3, 0.1689, 0.0022, 3, 0.08, 0.0, 279, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add_child", "arg_names": [], "import_names": [], "rhs_call_name": "add_child", "annotation": ""}, "snippet": " self.parent.add_child(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L77_C8", "label": "self.name =", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L69_C4", "vector": [14, 2, 0.1711, 0.0022, 2, 0.58, 1.0, 689, 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_1363:FunctionDef_L79_C4", "label": "add_child", "type": "function", "loc": [79, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "vector": [2, 1, 0.1767, 0.0044, 1, 0.59, 0.1111, 279, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "add_child", "arg_names": ["self", "child"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_child(self, child):\n self.child.append(child)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L80_C8", "label": "append()", "type": "expression", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L79_C4", "vector": [8, 2, 0.1778, 0.0022, 2, 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": " self.child.append(child)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L82_C4", "label": "find_child", "type": "function", "loc": [82, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "vector": [2, 1, 0.19, 0.0178, 1, 0.59, 0.2222, 611, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "find_child", "arg_names": ["self", "child_names"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def find_child(self, child_names):\n if child_names:\n for i in self.child:\n if i.name == child_names[0]:\n return i.find_child(child_names[1:])\n raise StandardError\n else:\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L83_C8", "label": "if", "type": "if", "loc": [83, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L82_C4", "vector": [4, 2, 0.1911, 0.0156, 2, 0.23, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if child_names:\n for i in self.child:\n if i.name == child_names[0]:\n return i.find_child(child_names[1:])\n raise StandardError\n else:\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L84_C12", "label": "for i", "type": "for", "loc": [84, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L83_C8", "vector": [6, 3, 0.1889, 0.0067, 3, 0.39, 0.0, 826, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in self.child:\n if i.name == child_names[0]:\n return i.find_child(child_names[1:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L85_C16", "label": "if", "type": "if", "loc": [85, 86], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L84_C12", "vector": [4, 4, 0.19, 0.0044, 4, 0.97, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i.name == child_names[0]:\n return i.find_child(child_names[1:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L86_C20", "label": "return", "type": "return", "loc": [86, 86], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L85_C16", "vector": [13, 5, 0.1911, 0.0022, 5, 0.79, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return i.find_child(child_names[1:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L89_C12", "label": "return", "type": "return", "loc": [89, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L83_C8", "vector": [13, 3, 0.1978, 0.0022, 3, 0.39, 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_1363:FunctionDef_L91_C4", "label": "get_child", "type": "function", "loc": [91, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "vector": [2, 1, 0.2067, 0.0111, 1, 0.59, 0.3333, 799, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "get_child", "arg_names": ["self", "child_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_child(self, child_name):\n for i in self.child:\n if i.name == child_name:\n return i\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L92_C8", "label": "for i", "type": "for", "loc": [92, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L91_C4", "vector": [6, 2, 0.2067, 0.0067, 2, 0.13, 0.0, 826, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in self.child:\n if i.name == child_name:\n return i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L93_C12", "label": "if", "type": "if", "loc": [93, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L92_C8", "vector": [4, 3, 0.2078, 0.0044, 3, 0.06, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i.name == child_name:\n return i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L94_C16", "label": "return", "type": "return", "loc": [94, 94], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L93_C12", "vector": [13, 4, 0.2089, 0.0022, 4, 0.2, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L95_C8", "label": "return", "type": "return", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L91_C4", "vector": [13, 2, 0.2111, 0.0022, 2, 0.13, 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_1363:FunctionDef_L97_C4", "label": "get_path", "type": "function", "loc": [97, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "vector": [2, 1, 0.2233, 0.0178, 1, 0.59, 0.4444, 601, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "get_path", "arg_names": ["self", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_path(self, end = None):\n pos = self\n out = []\n while pos and pos != end:\n out.append(pos.name)\n pos = pos.parent\n out.reverse()\n return '.'.join(out)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L98_C8", "label": "pos =", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L97_C4", "vector": [14, 2, 0.2178, 0.0022, 2, 0.06, 0.0, 627, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L99_C8", "label": "out =", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L97_C4", "vector": [14, 2, 0.22, 0.0022, 2, 0.06, 0.25, 434, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "out", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " out = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:While_L100_C8", "label": "while", "type": "while", "loc": [100, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L97_C4", "vector": [5, 2, 0.2244, 0.0067, 2, 0.06, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while pos and pos != end:\n out.append(pos.name)\n pos = pos.parent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L101_C12", "label": "append()", "type": "expression", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:While_L100_C8", "vector": [8, 3, 0.2244, 0.0022, 3, 0.9, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " out.append(pos.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L102_C12", "label": "pos =", "type": "assigned_variable", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:While_L100_C8", "vector": [14, 3, 0.2267, 0.0022, 3, 0.9, 1.0, 627, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = pos.parent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L103_C8", "label": "reverse()", "type": "expression", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L97_C4", "vector": [8, 2, 0.2289, 0.0022, 2, 0.06, 0.75, 109, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reverse", "arg_names": [], "import_names": [], "rhs_call_name": "reverse", "annotation": ""}, "snippet": " out.reverse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L104_C8", "label": "return", "type": "return", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L97_C4", "vector": [13, 2, 0.2311, 0.0022, 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 '.'.join(out)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L106_C4", "label": "get_global_name", "type": "function", "loc": [106, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "vector": [2, 1, 0.2367, 0.0044, 1, 0.59, 0.5556, 36, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_global_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_global_name(self):\n return self.get_path()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L107_C8", "label": "return", "type": "return", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L106_C4", "vector": [13, 2, 0.2378, 0.0022, 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 self.get_path()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L109_C4", "label": "get_local_name", "type": "function", "loc": [109, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "vector": [2, 1, 0.2489, 0.0156, 1, 0.59, 0.6667, 996, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_local_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_local_name(self):\n pos = self\n while pos.parent:\n pos = pos.parent\n if self.package and pos.name == self.package[-1]:\n break\n return self.get_path(pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L110_C8", "label": "pos =", "type": "assigned_variable", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L109_C4", "vector": [14, 2, 0.2444, 0.0022, 2, 0.07, 0.0, 627, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:While_L111_C8", "label": "while", "type": "while", "loc": [111, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L109_C4", "vector": [5, 2, 0.25, 0.0089, 2, 0.07, 0.5, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while pos.parent:\n pos = pos.parent\n if self.package and pos.name == self.package[-1]:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L112_C12", "label": "pos =", "type": "assigned_variable", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:While_L111_C8", "vector": [14, 3, 0.2489, 0.0022, 3, 0.05, 0.0, 627, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = pos.parent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L113_C12", "label": "if", "type": "if", "loc": [113, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:While_L111_C8", "vector": [4, 3, 0.2522, 0.0044, 3, 0.05, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.package and pos.name == self.package[-1]:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L115_C8", "label": "return", "type": "return", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L109_C4", "vector": [13, 2, 0.2556, 0.0022, 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.get_path(pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L117_C4", "label": "__str__", "type": "function", "loc": [117, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "vector": [2, 1, 0.2611, 0.0044, 1, 0.59, 0.7778, 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(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L118_C8", "label": "return", "type": "return", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L117_C4", "vector": [13, 2, 0.2622, 0.0022, 2, 0.33, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.to_string(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L120_C4", "label": "__repr__", "type": "function", "loc": [120, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "vector": [2, 1, 0.2678, 0.0044, 1, 0.59, 0.8889, 204, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__repr__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __repr__(self):\n return str(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L121_C8", "label": "return", "type": "return", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L120_C4", "vector": [13, 2, 0.2689, 0.0022, 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 str(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L123_C4", "label": "to_string", "type": "function", "loc": [123, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "vector": [2, 1, 0.2767, 0.0089, 1, 0.59, 1.0, 549, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "to_string", "arg_names": ["self", "indent"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def to_string(self, indent = 0):\n return ' '*indent + '<TreeNode ' + self.name + '(\\n' + \\\n ','.join([i.to_string(indent + 4) for i in self.child]) + \\\n ' '*indent +')>\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L124_C8", "label": "return", "type": "return", "loc": [124, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L123_C4", "vector": [13, 2, 0.2778, 0.0067, 2, 0.51, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ' '*indent + '<TreeNode ' + self.name + '(\\n' + \\\n ','.join([i.to_string(indent + 4) for i in self.child]) + \\\n ' '*indent +')>\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "label": "Env", "type": "class", "loc": [128, 205], "level": 0, "parent": null, "vector": [3, 0, 0.37, 0.1733, 0, 0.66, 0.5833, 510, 0, 12, 0, 0, 186, 0, 21], "semantic": {"name": "Env", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Env(object):\n filename = None\n package = None\n extend = None\n descriptor = None\n message = None\n context = None\n register = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L129_C4", "label": "filename =", "type": "assigned_variable", "loc": [129, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "vector": [14, 1, 0.2867, 0.0022, 1, 0.54, 0.0, 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_1363:Assign_L130_C4", "label": "package =", "type": "assigned_variable", "loc": [130, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "vector": [14, 1, 0.2889, 0.0022, 1, 0.54, 0.0556, 187, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "package", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " package = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L131_C4", "label": "extend =", "type": "assigned_variable", "loc": [131, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "vector": [14, 1, 0.2911, 0.0022, 1, 0.54, 0.1111, 660, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extend = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L132_C4", "label": "descriptor =", "type": "assigned_variable", "loc": [132, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "vector": [14, 1, 0.2933, 0.0022, 1, 0.54, 0.1667, 420, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "descriptor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " descriptor = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L133_C4", "label": "message =", "type": "assigned_variable", "loc": [133, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "vector": [14, 1, 0.2956, 0.0022, 1, 0.54, 0.2222, 635, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " message = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L134_C4", "label": "context =", "type": "assigned_variable", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "vector": [14, 1, 0.2978, 0.0022, 1, 0.54, 0.2778, 954, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L135_C4", "label": "register =", "type": "assigned_variable", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "vector": [14, 1, 0.3, 0.0022, 1, 0.54, 0.3333, 276, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "register", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " register = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L136_C4", "label": "__init__", "type": "function", "loc": [136, 138], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "vector": [2, 1, 0.3044, 0.0067, 1, 0.54, 0.3889, 555, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n self.message_tree = TreeNode('')\n self.scope = self.message_tree"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L137_C8", "label": "self.message_tree = TreeNode()", "type": "assigned_variable", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L136_C4", "vector": [14, 2, 0.3044, 0.0022, 2, 0.43, 0.0, 121, 3, 1, 0, 0, 30, 10, 1], "semantic": {"name": "self.message_tree", "arg_names": [], "import_names": [], "rhs_call_name": "TreeNode", "annotation": ""}, "snippet": " self.message_tree = TreeNode('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L138_C8", "label": "self.scope =", "type": "assigned_variable", "loc": [138, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L136_C4", "vector": [14, 2, 0.3067, 0.0022, 2, 0.43, 1.0, 550, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.scope", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.scope = self.message_tree"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L140_C4", "label": "get_global_name", "type": "function", "loc": [140, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "vector": [2, 1, 0.3122, 0.0044, 1, 0.54, 0.4444, 36, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_global_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_global_name(self):\n return self.scope.get_global_name()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L141_C8", "label": "return", "type": "return", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L140_C4", "vector": [13, 2, 0.3133, 0.0022, 2, 0.51, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.scope.get_global_name()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L143_C4", "label": "get_local_name", "type": "function", "loc": [143, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "vector": [2, 1, 0.3189, 0.0044, 1, 0.54, 0.5, 996, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_local_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_local_name(self):\n return self.scope.get_local_name()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L144_C8", "label": "return", "type": "return", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L143_C4", "vector": [13, 2, 0.32, 0.0022, 2, 0.95, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.scope.get_local_name()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L146_C4", "label": "get_ref_name", "type": "function", "loc": [146, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "vector": [2, 1, 0.3333, 0.02, 1, 0.54, 0.5556, 958, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "get_ref_name", "arg_names": ["self", "type_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_ref_name(self, type_name):\n try:\n node = self.lookup_name(type_name)\n except:\n # if the child doesn't be founded, it must be in this file\n return type_name[len('.'.join(self.package)) + 2:]\n if node.filename != self.filename:\n return node.filename + '_pb.' + node.get_local_name()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Try_L147_C8", "label": "try", "type": "try", "loc": [147, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L146_C4", "vector": [7, 2, 0.3311, 0.0111, 2, 0.46, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n node = self.lookup_name(type_name)\n except:\n # if the child doesn't be founded, it must be in this file\n return type_name[len('.'.join(self.package)) + 2:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L148_C12", "label": "node = lookup_name()", "type": "assigned_variable", "loc": [148, 148], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:Try_L147_C8", "vector": [14, 3, 0.3289, 0.0022, 3, 0.79, 0.0, 772, 3, 1, 0, 0, 962, 10, 1], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "lookup_name", "annotation": ""}, "snippet": " node = self.lookup_name(type_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L151_C12", "label": "return", "type": "return", "loc": [151, 151], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:Try_L147_C8", "vector": [13, 3, 0.3356, 0.0022, 3, 0.79, 0.0, 0, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return type_name[len('.'.join(self.package)) + 2:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L152_C8", "label": "if", "type": "if", "loc": [152, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L146_C4", "vector": [4, 2, 0.3389, 0.0044, 2, 0.46, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if node.filename != self.filename:\n return node.filename + '_pb.' + node.get_local_name()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L153_C12", "label": "return", "type": "return", "loc": [153, 153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L152_C8", "vector": [13, 3, 0.34, 0.0022, 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 node.filename + '_pb.' + node.get_local_name()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L154_C8", "label": "return", "type": "return", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L146_C4", "vector": [13, 2, 0.3422, 0.0022, 2, 0.46, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return node.get_local_name()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L156_C4", "label": "lookup_name", "type": "function", "loc": [156, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "vector": [2, 1, 0.3522, 0.0133, 1, 0.54, 0.6111, 962, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "lookup_name", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lookup_name(self, name):\n names = name.split('.')\n if names[0] == '':\n return self.message_tree.find_child(names[1:])\n else:\n return self.scope.parent.find_child(names)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L157_C8", "label": "names = split()", "type": "assigned_variable", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L156_C4", "vector": [14, 2, 0.3489, 0.0022, 2, 0.24, 0.0, 382, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "names", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " names = name.split('.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L158_C8", "label": "if", "type": "if", "loc": [158, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L156_C4", "vector": [4, 2, 0.3544, 0.0089, 2, 0.24, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if names[0] == '':\n return self.message_tree.find_child(names[1:])\n else:\n return self.scope.parent.find_child(names)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L159_C12", "label": "return", "type": "return", "loc": [159, 159], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L158_C8", "vector": [13, 3, 0.3533, 0.0022, 3, 0.88, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.message_tree.find_child(names[1:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L161_C12", "label": "return", "type": "return", "loc": [161, 161], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L158_C8", "vector": [13, 3, 0.3578, 0.0022, 3, 0.88, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.scope.parent.find_child(names)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L163_C4", "label": "enter_package", "type": "function", "loc": [163, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "vector": [2, 1, 0.3744, 0.0267, 1, 0.54, 0.6667, 132, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "enter_package", "arg_names": ["self", "package"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def enter_package(self, package):\n if not package:\n return self.message_tree\n names = package.split('.')\n pos = self.message_tree\n for i, name in enumerate(names):\n new_pos = pos.get_child(name)\n if new_pos:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L164_C8", "label": "if", "type": "if", "loc": [164, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L163_C4", "vector": [4, 2, 0.3656, 0.0044, 2, 0.55, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not package:\n return self.message_tree"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L165_C12", "label": "return", "type": "return", "loc": [165, 165], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L164_C8", "vector": [13, 3, 0.3667, 0.0022, 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 self.message_tree"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L166_C8", "label": "names = split()", "type": "assigned_variable", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L163_C4", "vector": [14, 2, 0.3689, 0.0022, 2, 0.55, 0.25, 382, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "names", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " names = package.split('.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L167_C8", "label": "pos =", "type": "assigned_variable", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L163_C4", "vector": [14, 2, 0.3711, 0.0022, 2, 0.55, 0.5, 627, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = self.message_tree"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L168_C8", "label": "for i, name", "type": "for", "loc": [168, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L163_C4", "vector": [6, 2, 0.3789, 0.0133, 2, 0.55, 0.75, 14, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i, name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, name in enumerate(names):\n new_pos = pos.get_child(name)\n if new_pos:\n pos = new_pos\n else:\n return self._build_nodes(pos, names[i:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L169_C12", "label": "new_pos = get_child()", "type": "assigned_variable", "loc": [169, 169], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L168_C8", "vector": [14, 3, 0.3756, 0.0022, 3, 0.71, 0.0, 414, 3, 1, 0, 0, 799, 10, 1], "semantic": {"name": "new_pos", "arg_names": [], "import_names": [], "rhs_call_name": "get_child", "annotation": ""}, "snippet": " new_pos = pos.get_child(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L170_C12", "label": "if", "type": "if", "loc": [170, 173], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L168_C8", "vector": [4, 3, 0.3811, 0.0089, 3, 0.71, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if new_pos:\n pos = new_pos\n else:\n return self._build_nodes(pos, names[i:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L171_C16", "label": "pos =", "type": "assigned_variable", "loc": [171, 171], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L170_C12", "vector": [14, 4, 0.38, 0.0022, 4, 0.34, 0.0, 627, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = new_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L173_C16", "label": "return", "type": "return", "loc": [173, 173], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L170_C12", "vector": [13, 4, 0.3844, 0.0022, 4, 0.34, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._build_nodes(pos, names[i:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L174_C8", "label": "return", "type": "return", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L163_C4", "vector": [13, 2, 0.3867, 0.0022, 2, 0.55, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L176_C4", "label": "enter_file", "type": "function", "loc": [176, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "vector": [2, 1, 0.3956, 0.0111, 1, 0.54, 0.7222, 739, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "enter_file", "arg_names": ["self", "filename", "package"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def enter_file(self, filename, package):\n self.filename = filename\n self.package = package.split('.')\n self._init_field()\n self.scope = self.enter_package(package)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L177_C8", "label": "self.filename =", "type": "assigned_variable", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L176_C4", "vector": [14, 2, 0.3933, 0.0022, 2, 0.88, 0.0, 942, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.filename = filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L178_C8", "label": "self.package = split()", "type": "assigned_variable", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L176_C4", "vector": [14, 2, 0.3956, 0.0022, 2, 0.88, 0.3333, 544, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "self.package", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " self.package = package.split('.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L179_C8", "label": "_init_field()", "type": "expression", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L176_C4", "vector": [8, 2, 0.3978, 0.0022, 2, 0.88, 0.6667, 721, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_init_field", "arg_names": [], "import_names": [], "rhs_call_name": "_init_field", "annotation": ""}, "snippet": " self._init_field()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L180_C8", "label": "self.scope = enter_package()", "type": "assigned_variable", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L176_C4", "vector": [14, 2, 0.4, 0.0022, 2, 0.88, 1.0, 550, 3, 1, 0, 0, 132, 10, 1], "semantic": {"name": "self.scope", "arg_names": [], "import_names": [], "rhs_call_name": "enter_package", "annotation": ""}, "snippet": " self.scope = self.enter_package(package)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L182_C4", "label": "exit_file", "type": "function", "loc": [182, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "vector": [2, 1, 0.4089, 0.0111, 1, 0.54, 0.7778, 520, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit_file", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def exit_file(self):\n self._init_field()\n self.filename = None\n self.package = []\n self.scope = self.scope.parent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L183_C8", "label": "_init_field()", "type": "expression", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L182_C4", "vector": [8, 2, 0.4067, 0.0022, 2, 0.96, 0.0, 721, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_init_field", "arg_names": [], "import_names": [], "rhs_call_name": "_init_field", "annotation": ""}, "snippet": " self._init_field()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L184_C8", "label": "self.filename =", "type": "assigned_variable", "loc": [184, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L182_C4", "vector": [14, 2, 0.4089, 0.0022, 2, 0.96, 0.3333, 942, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.filename = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L185_C8", "label": "self.package =", "type": "assigned_variable", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L182_C4", "vector": [14, 2, 0.4111, 0.0022, 2, 0.96, 0.6667, 544, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.package", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.package = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L186_C8", "label": "self.scope =", "type": "assigned_variable", "loc": [186, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L182_C4", "vector": [14, 2, 0.4133, 0.0022, 2, 0.96, 1.0, 550, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.scope", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.scope = self.scope.parent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L188_C4", "label": "enter", "type": "function", "loc": [188, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "vector": [2, 1, 0.42, 0.0067, 1, 0.54, 0.8333, 196, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "enter", "arg_names": ["self", "message_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def enter(self, message_name):\n self.scope = TreeNode(message_name, self.scope, self.filename,\n self.package)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L189_C8", "label": "self.scope = TreeNode()", "type": "assigned_variable", "loc": [189, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L188_C4", "vector": [14, 2, 0.4211, 0.0044, 2, 0.75, 0.0, 550, 3, 4, 0, 0, 30, 10, 1], "semantic": {"name": "self.scope", "arg_names": [], "import_names": [], "rhs_call_name": "TreeNode", "annotation": ""}, "snippet": " self.scope = TreeNode(message_name, self.scope, self.filename,\n self.package)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L192_C4", "label": "exit", "type": "function", "loc": [192, 193], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "vector": [2, 1, 0.4278, 0.0044, 1, 0.54, 0.8889, 436, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "exit", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def exit(self):\n self.scope = self.scope.parent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L193_C8", "label": "self.scope =", "type": "assigned_variable", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L192_C4", "vector": [14, 2, 0.4289, 0.0022, 2, 0.99, 0.0, 550, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.scope", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.scope = self.scope.parent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L195_C4", "label": "_init_field", "type": "function", "loc": [195, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "vector": [2, 1, 0.4378, 0.0111, 1, 0.54, 0.9444, 721, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "_init_field", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _init_field(self):\n self.descriptor = []\n self.context = []\n self.message = []\n self.register = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L196_C8", "label": "self.descriptor =", "type": "assigned_variable", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L195_C4", "vector": [14, 2, 0.4356, 0.0022, 2, 0.7, 0.0, 955, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.descriptor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.descriptor = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L197_C8", "label": "self.context =", "type": "assigned_variable", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L195_C4", "vector": [14, 2, 0.4378, 0.0022, 2, 0.7, 0.3333, 249, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.context = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L198_C8", "label": "self.message =", "type": "assigned_variable", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L195_C4", "vector": [14, 2, 0.44, 0.0022, 2, 0.7, 0.6667, 709, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.message = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L199_C8", "label": "self.register =", "type": "assigned_variable", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L195_C4", "vector": [14, 2, 0.4422, 0.0022, 2, 0.7, 1.0, 105, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.register", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.register = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L201_C4", "label": "_build_nodes", "type": "function", "loc": [201, 205], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "vector": [2, 1, 0.4511, 0.0111, 1, 0.54, 1.0, 569, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "_build_nodes", "arg_names": ["self", "node", "names"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _build_nodes(self, node, names):\n parent = node\n for i in names:\n parent = TreeNode(i, parent, self.filename, self.package)\n return parent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L202_C8", "label": "parent =", "type": "assigned_variable", "loc": [202, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L201_C4", "vector": [14, 2, 0.4489, 0.0022, 2, 0.83, 0.0, 80, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parent = node"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L203_C8", "label": "for i", "type": "for", "loc": [203, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L201_C4", "vector": [6, 2, 0.4522, 0.0044, 2, 0.83, 0.5, 826, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in names:\n parent = TreeNode(i, parent, self.filename, self.package)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L204_C12", "label": "parent = TreeNode()", "type": "assigned_variable", "loc": [204, 204], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L203_C8", "vector": [14, 3, 0.4533, 0.0022, 3, 0.36, 0.0, 80, 3, 4, 0, 0, 30, 10, 1], "semantic": {"name": "parent", "arg_names": [], "import_names": [], "rhs_call_name": "TreeNode", "annotation": ""}, "snippet": " parent = TreeNode(i, parent, self.filename, self.package)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L205_C8", "label": "return", "type": "return", "loc": [205, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L201_C4", "vector": [13, 2, 0.4556, 0.0022, 2, 0.83, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L207_C0", "label": "Writer", "type": "class", "loc": [207, 227], "level": 0, "parent": null, "vector": [3, 0, 0.4822, 0.0467, 0, 0.66, 0.625, 839, 0, 5, 0, 0, 186, 0, 5], "semantic": {"name": "Writer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Writer(object):\n def __init__(self, prefix=None):\n self.io = StringIO()\n self.__indent = ''\n self.__prefix = prefix\n\n def getvalue(self):\n return self.io.getvalue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L208_C4", "label": "__init__", "type": "function", "loc": [208, 211], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L207_C0", "vector": [2, 1, 0.4656, 0.0089, 1, 0.58, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "prefix"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, prefix=None):\n self.io = StringIO()\n self.__indent = ''\n self.__prefix = prefix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L209_C8", "label": "self.io = StringIO()", "type": "assigned_variable", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L208_C4", "vector": [14, 2, 0.4644, 0.0022, 2, 0.13, 0.0, 250, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "self.io", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " self.io = StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L210_C8", "label": "self.__indent =", "type": "assigned_variable", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L208_C4", "vector": [14, 2, 0.4667, 0.0022, 2, 0.13, 0.5, 352, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.__indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__indent = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L211_C8", "label": "self.__prefix =", "type": "assigned_variable", "loc": [211, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L208_C4", "vector": [14, 2, 0.4689, 0.0022, 2, 0.13, 1.0, 584, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.__prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__prefix = prefix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L213_C4", "label": "getvalue", "type": "function", "loc": [213, 214], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L207_C0", "vector": [2, 1, 0.4744, 0.0044, 1, 0.58, 0.25, 626, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "getvalue", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def getvalue(self):\n return self.io.getvalue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L214_C8", "label": "return", "type": "return", "loc": [214, 214], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L213_C4", "vector": [13, 2, 0.4756, 0.0022, 2, 0.28, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.io.getvalue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L216_C4", "label": "__enter__", "type": "function", "loc": [216, 218], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L207_C0", "vector": [2, 1, 0.4822, 0.0067, 1, 0.58, 0.5, 230, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__enter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __enter__(self):\n self.__indent += ' '\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L218_C8", "label": "return", "type": "return", "loc": [218, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L216_C4", "vector": [13, 2, 0.4844, 0.0022, 2, 0.08, 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_1363:FunctionDef_L220_C4", "label": "__exit__", "type": "function", "loc": [220, 221], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L207_C0", "vector": [2, 1, 0.49, 0.0044, 1, 0.58, 0.75, 12, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "__exit__", "arg_names": ["self", "type", "value", "trackback"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __exit__(self, type, value, trackback):\n self.__indent = self.__indent[:-4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L221_C8", "label": "self.__indent =", "type": "assigned_variable", "loc": [221, 221], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L220_C4", "vector": [14, 2, 0.4911, 0.0022, 2, 0.53, 0.0, 352, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.__indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__indent = self.__indent[:-4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L223_C4", "label": "__call__", "type": "function", "loc": [223, 227], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L207_C0", "vector": [2, 1, 0.5, 0.0111, 1, 0.58, 1.0, 319, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "__call__", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __call__(self, data):\n self.io.write(self.__indent)\n if self.__prefix:\n self.io.write(self.__prefix)\n self.io.write(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L224_C8", "label": "write()", "type": "expression", "loc": [224, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L223_C4", "vector": [8, 2, 0.4978, 0.0022, 2, 0.01, 0.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.io.write(self.__indent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L225_C8", "label": "if", "type": "if", "loc": [225, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L223_C4", "vector": [4, 2, 0.5011, 0.0044, 2, 0.01, 0.5, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.__prefix:\n self.io.write(self.__prefix)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L226_C12", "label": "write()", "type": "expression", "loc": [226, 226], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L225_C8", "vector": [8, 3, 0.5022, 0.0022, 3, 0.43, 0.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.io.write(self.__prefix)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L227_C8", "label": "write()", "type": "expression", "loc": [227, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L223_C4", "vector": [8, 2, 0.5044, 0.0022, 2, 0.01, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.io.write(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L229_C0", "label": "DEFAULT_VALUE =", "type": "assigned_variable", "loc": [229, 247], "level": 0, "parent": null, "vector": [14, 0, 0.5289, 0.0422, 0, 0.66, 0.6667, 202, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "DEFAULT_VALUE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEFAULT_VALUE = {\n FDP.TYPE_DOUBLE : '0.0',\n FDP.TYPE_FLOAT : '0.0',\n FDP.TYPE_INT64 : '0',\n FDP.TYPE_UINT64 : '0',\n FDP.TYPE_INT32 : '0',\n FDP.TYPE_FIXED64 : '0',\n FDP.TYPE_FIXED32 : '0',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L249_C0", "label": "code_gen_enum_item", "type": "function", "loc": [249, 262], "level": 0, "parent": null, "vector": [2, 0, 0.5678, 0.0311, 0, 0.66, 0.7083, 746, 0, 3, 1, 0, 0, 0, 10], "semantic": {"name": "code_gen_enum_item", "arg_names": ["index", "enum_value", "env"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def code_gen_enum_item(index, enum_value, env):\n full_name = env.get_local_name() + '.' + enum_value.name\n obj_name = full_name.upper().replace('.', '_') + '_ENUM'\n env.descriptor.append(\n \"local %s = protobuf.EnumValueDescriptor();\\n\"% obj_name\n )\n\n context = Writer(obj_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L250_C4", "label": "full_name =", "type": "assigned_variable", "loc": [250, 250], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L249_C0", "vector": [14, 1, 0.5556, 0.0022, 1, 0.96, 0.0, 869, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "full_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " full_name = env.get_local_name() + '.' + enum_value.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L251_C4", "label": "obj_name =", "type": "assigned_variable", "loc": [251, 251], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L249_C0", "vector": [14, 1, 0.5578, 0.0022, 1, 0.96, 0.125, 412, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "obj_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj_name = full_name.upper().replace('.', '_') + '_ENUM'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L252_C4", "label": "append()", "type": "expression", "loc": [252, 254], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L249_C0", "vector": [8, 1, 0.5622, 0.0067, 1, 0.96, 0.25, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " env.descriptor.append(\n \"local %s = protobuf.EnumValueDescriptor();\\n\"% obj_name\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L256_C4", "label": "context = Writer()", "type": "assigned_variable", "loc": [256, 256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L249_C0", "vector": [14, 1, 0.5689, 0.0022, 1, 0.96, 0.375, 954, 3, 1, 0, 0, 839, 10, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "Writer", "annotation": ""}, "snippet": " context = Writer(obj_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L257_C4", "label": "context()", "type": "expression", "loc": [257, 257], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L249_C0", "vector": [8, 1, 0.5711, 0.0022, 1, 0.96, 0.5, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.name = \"%s\"\\n' % enum_value.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L258_C4", "label": "context()", "type": "expression", "loc": [258, 258], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L249_C0", "vector": [8, 1, 0.5733, 0.0022, 1, 0.96, 0.625, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.index = %d\\n' % index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L259_C4", "label": "context()", "type": "expression", "loc": [259, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L249_C0", "vector": [8, 1, 0.5756, 0.0022, 1, 0.96, 0.75, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.number = %d\\n' % enum_value.number)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L261_C4", "label": "append()", "type": "expression", "loc": [261, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L249_C0", "vector": [8, 1, 0.58, 0.0022, 1, 0.96, 0.875, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " env.context.append(context.getvalue())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L262_C4", "label": "return", "type": "return", "loc": [262, 262], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L249_C0", "vector": [13, 1, 0.5822, 0.0022, 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 obj_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "label": "code_gen_enum", "type": "function", "loc": [264, 283], "level": 0, "parent": null, "vector": [2, 0, 0.6078, 0.0444, 0, 0.66, 0.75, 768, 0, 2, 1, 0, 0, 0, 17], "semantic": {"name": "code_gen_enum", "arg_names": ["enum_desc", "env"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def code_gen_enum(enum_desc, env):\n env.enter(enum_desc.name)\n full_name = env.get_local_name()\n obj_name = full_name.upper().replace('.', '_')\n env.descriptor.append(\n \"local %s = protobuf.EnumDescriptor();\\n\"% obj_name\n )\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L265_C4", "label": "enter()", "type": "expression", "loc": [265, 265], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "vector": [8, 1, 0.5889, 0.0022, 1, 0.84, 0.0, 196, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "enter", "arg_names": [], "import_names": [], "rhs_call_name": "enter", "annotation": ""}, "snippet": " env.enter(enum_desc.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L266_C4", "label": "full_name = get_local_name()", "type": "assigned_variable", "loc": [266, 266], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "vector": [14, 1, 0.5911, 0.0022, 1, 0.84, 0.0833, 869, 3, 0, 0, 0, 996, 10, 1], "semantic": {"name": "full_name", "arg_names": [], "import_names": [], "rhs_call_name": "get_local_name", "annotation": ""}, "snippet": " full_name = env.get_local_name()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L267_C4", "label": "obj_name = replace()", "type": "assigned_variable", "loc": [267, 267], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "vector": [14, 1, 0.5933, 0.0022, 1, 0.84, 0.1667, 412, 3, 2, 0, 0, 293, 10, 2], "semantic": {"name": "obj_name", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " obj_name = full_name.upper().replace('.', '_')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L268_C4", "label": "append()", "type": "expression", "loc": [268, 270], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "vector": [8, 1, 0.5978, 0.0067, 1, 0.84, 0.25, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " env.descriptor.append(\n \"local %s = protobuf.EnumDescriptor();\\n\"% obj_name\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L272_C4", "label": "context = Writer()", "type": "assigned_variable", "loc": [272, 272], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "vector": [14, 1, 0.6044, 0.0022, 1, 0.84, 0.3333, 954, 3, 1, 0, 0, 839, 10, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "Writer", "annotation": ""}, "snippet": " context = Writer(obj_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L273_C4", "label": "context()", "type": "expression", "loc": [273, 273], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "vector": [8, 1, 0.6067, 0.0022, 1, 0.84, 0.4167, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.name = \"%s\"\\n' % enum_desc.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L274_C4", "label": "context()", "type": "expression", "loc": [274, 274], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "vector": [8, 1, 0.6089, 0.0022, 1, 0.84, 0.5, 954, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.full_name = \"%s\"\\n' % env.get_global_name())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L276_C4", "label": "values =", "type": "assigned_variable", "loc": [276, 276], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "vector": [14, 1, 0.6133, 0.0022, 1, 0.84, 0.5833, 721, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "values", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " values = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L277_C4", "label": "for i, enum_value", "type": "for", "loc": [277, 278], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "vector": [6, 1, 0.6167, 0.0044, 1, 0.84, 0.6667, 466, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i, enum_value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, enum_value in enumerate(enum_desc.value):\n values.append(code_gen_enum_item(i, enum_value, env))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L278_C8", "label": "append()", "type": "expression", "loc": [278, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L277_C4", "vector": [8, 2, 0.6178, 0.0022, 2, 0.22, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " values.append(code_gen_enum_item(i, enum_value, env))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L279_C4", "label": "context()", "type": "expression", "loc": [279, 279], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "vector": [8, 1, 0.62, 0.0022, 1, 0.84, 0.75, 954, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.values = {%s}\\n' % ','.join(values))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L281_C4", "label": "append()", "type": "expression", "loc": [281, 281], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "vector": [8, 1, 0.6244, 0.0022, 1, 0.84, 0.8333, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " env.context.append(context.getvalue())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L282_C4", "label": "exit()", "type": "expression", "loc": [282, 282], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "vector": [8, 1, 0.6267, 0.0022, 1, 0.84, 0.9167, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " env.exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L283_C4", "label": "return", "type": "return", "loc": [283, 283], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "vector": [13, 1, 0.6289, 0.0022, 1, 0.84, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return obj_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "label": "code_gen_field", "type": "function", "loc": [285, 334], "level": 0, "parent": null, "vector": [2, 0, 0.6878, 0.1111, 0, 0.66, 0.7917, 864, 0, 3, 1, 0, 0, 0, 31], "semantic": {"name": "code_gen_field", "arg_names": ["index", "field_desc", "env"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def code_gen_field(index, field_desc, env):\n full_name = env.get_local_name() + '.' + field_desc.name\n obj_name = full_name.upper().replace('.', '_') + '_FIELD'\n env.descriptor.append(\n \"local %s = protobuf.FieldDescriptor();\\n\"% obj_name\n )\n\n context = Writer(obj_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L286_C4", "label": "full_name =", "type": "assigned_variable", "loc": [286, 286], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "vector": [14, 1, 0.6356, 0.0022, 1, 0.46, 0.0, 869, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "full_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " full_name = env.get_local_name() + '.' + field_desc.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L287_C4", "label": "obj_name =", "type": "assigned_variable", "loc": [287, 287], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "vector": [14, 1, 0.6378, 0.0022, 1, 0.46, 0.0667, 412, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "obj_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj_name = full_name.upper().replace('.', '_') + '_FIELD'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L288_C4", "label": "append()", "type": "expression", "loc": [288, 290], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "vector": [8, 1, 0.6422, 0.0067, 1, 0.46, 0.1333, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " env.descriptor.append(\n \"local %s = protobuf.FieldDescriptor();\\n\"% obj_name\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L292_C4", "label": "context = Writer()", "type": "assigned_variable", "loc": [292, 292], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "vector": [14, 1, 0.6489, 0.0022, 1, 0.46, 0.2, 954, 3, 1, 0, 0, 839, 10, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "Writer", "annotation": ""}, "snippet": " context = Writer(obj_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L294_C4", "label": "context()", "type": "expression", "loc": [294, 294], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "vector": [8, 1, 0.6533, 0.0022, 1, 0.46, 0.2667, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.name = \"%s\"\\n' % field_desc.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L295_C4", "label": "context()", "type": "expression", "loc": [295, 296], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "vector": [8, 1, 0.6567, 0.0044, 1, 0.46, 0.3333, 954, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.full_name = \"%s\"\\n' % (\n env.get_global_name() + '.' + field_desc.name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L297_C4", "label": "context()", "type": "expression", "loc": [297, 297], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "vector": [8, 1, 0.66, 0.0022, 1, 0.46, 0.4, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.number = %d\\n' % field_desc.number)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L298_C4", "label": "context()", "type": "expression", "loc": [298, 298], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "vector": [8, 1, 0.6622, 0.0022, 1, 0.46, 0.4667, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.index = %d\\n' % index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L299_C4", "label": "context()", "type": "expression", "loc": [299, 299], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "vector": [8, 1, 0.6644, 0.0022, 1, 0.46, 0.5333, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.label = %d\\n' % field_desc.label)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L301_C4", "label": "if", "type": "if", "loc": [301, 316], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "vector": [4, 1, 0.6856, 0.0356, 1, 0.46, 0.6, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field_desc.HasField(\"default_value\"):\n context('.has_default_value = true\\n')\n value = field_desc.default_value\n if field_desc.type == FDP.TYPE_STRING:\n context('.default_value = \"%s\"\\n'%value)\n else:\n context('.default_value = %s\\n'%value)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L302_C8", "label": "context()", "type": "expression", "loc": [302, 302], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L301_C4", "vector": [8, 2, 0.6711, 0.0022, 2, 0.17, 0.0, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.has_default_value = true\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L303_C8", "label": "value =", "type": "assigned_variable", "loc": [303, 303], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L301_C4", "vector": [14, 2, 0.6733, 0.0022, 2, 0.17, 0.2, 441, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = field_desc.default_value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L304_C8", "label": "if", "type": "if", "loc": [304, 307], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L301_C4", "vector": [4, 2, 0.6789, 0.0089, 2, 0.17, 0.4, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field_desc.type == FDP.TYPE_STRING:\n context('.default_value = \"%s\"\\n'%value)\n else:\n context('.default_value = %s\\n'%value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L305_C12", "label": "context()", "type": "expression", "loc": [305, 305], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L304_C8", "vector": [8, 3, 0.6778, 0.0022, 3, 0.42, 0.0, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.default_value = \"%s\"\\n'%value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L307_C12", "label": "context()", "type": "expression", "loc": [307, 307], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L304_C8", "vector": [8, 3, 0.6822, 0.0022, 3, 0.42, 1.0, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.default_value = %s\\n'%value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L309_C8", "label": "context()", "type": "expression", "loc": [309, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L301_C4", "vector": [8, 2, 0.6867, 0.0022, 2, 0.17, 0.6, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.has_default_value = false\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L310_C8", "label": "if", "type": "if", "loc": [310, 315], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L301_C4", "vector": [4, 2, 0.6944, 0.0133, 2, 0.17, 0.8, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field_desc.label == FDP.LABEL_REPEATED:\n default_value = \"{}\"\n elif field_desc.HasField('type_name'):\n default_value = \"nil\"\n else:\n default_value = DEFAULT_VALUE[field_desc.type]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L311_C12", "label": "default_value =", "type": "assigned_variable", "loc": [311, 311], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L310_C8", "vector": [14, 3, 0.6911, 0.0022, 3, 0.93, 0.0, 876, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "default_value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " default_value = \"{}\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L312_C8", "label": "if", "type": "if", "loc": [312, 315], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L310_C8", "vector": [4, 3, 0.6967, 0.0089, 3, 0.93, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif field_desc.HasField('type_name'):\n default_value = \"nil\"\n else:\n default_value = DEFAULT_VALUE[field_desc.type]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L313_C12", "label": "default_value =", "type": "assigned_variable", "loc": [313, 313], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L312_C8", "vector": [14, 4, 0.6956, 0.0022, 4, 0.66, 0.0, 876, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "default_value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " default_value = \"nil\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L315_C12", "label": "default_value =", "type": "assigned_variable", "loc": [315, 315], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L312_C8", "vector": [14, 4, 0.7, 0.0022, 4, 0.66, 1.0, 876, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "default_value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " default_value = DEFAULT_VALUE[field_desc.type]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L316_C8", "label": "context()", "type": "expression", "loc": [316, 316], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L301_C4", "vector": [8, 2, 0.7022, 0.0022, 2, 0.17, 1.0, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.default_value = %s\\n' % default_value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L318_C4", "label": "if", "type": "if", "loc": [318, 323], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "vector": [4, 1, 0.7122, 0.0133, 1, 0.46, 0.6667, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field_desc.HasField('type_name'):\n type_name = env.get_ref_name(field_desc.type_name).upper().replace('.', '_')\n if field_desc.type == FDP.TYPE_MESSAGE:\n context('.message_type = %s\\n' % type_name)\n else:\n context('.enum_type = %s\\n' % type_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L319_C8", "label": "type_name = replace()", "type": "assigned_variable", "loc": [319, 319], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L318_C4", "vector": [14, 2, 0.7089, 0.0022, 2, 0.18, 0.0, 81, 3, 2, 0, 0, 293, 10, 3], "semantic": {"name": "type_name", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " type_name = env.get_ref_name(field_desc.type_name).upper().replace('.', '_')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L320_C8", "label": "if", "type": "if", "loc": [320, 323], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L318_C4", "vector": [4, 2, 0.7144, 0.0089, 2, 0.18, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field_desc.type == FDP.TYPE_MESSAGE:\n context('.message_type = %s\\n' % type_name)\n else:\n context('.enum_type = %s\\n' % type_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L321_C12", "label": "context()", "type": "expression", "loc": [321, 321], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L320_C8", "vector": [8, 3, 0.7133, 0.0022, 3, 0.92, 0.0, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.message_type = %s\\n' % type_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L323_C12", "label": "context()", "type": "expression", "loc": [323, 323], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L320_C8", "vector": [8, 3, 0.7178, 0.0022, 3, 0.92, 1.0, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.enum_type = %s\\n' % type_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L325_C4", "label": "if", "type": "if", "loc": [325, 329], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "vector": [4, 1, 0.7267, 0.0111, 1, 0.46, 0.7333, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field_desc.HasField('extendee'):\n type_name = env.get_ref_name(field_desc.extendee)\n env.register.append(\n \"%s.RegisterExtension(%s)\\n\" % (type_name, obj_name)\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L326_C8", "label": "type_name = get_ref_name()", "type": "assigned_variable", "loc": [326, 326], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L325_C4", "vector": [14, 2, 0.7244, 0.0022, 2, 0.2, 0.0, 81, 3, 1, 0, 0, 958, 10, 1], "semantic": {"name": "type_name", "arg_names": [], "import_names": [], "rhs_call_name": "get_ref_name", "annotation": ""}, "snippet": " type_name = env.get_ref_name(field_desc.extendee)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L327_C8", "label": "append()", "type": "expression", "loc": [327, 329], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L325_C4", "vector": [8, 2, 0.7289, 0.0067, 2, 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": " env.register.append(\n \"%s.RegisterExtension(%s)\\n\" % (type_name, obj_name)\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L331_C4", "label": "context()", "type": "expression", "loc": [331, 331], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "vector": [8, 1, 0.7356, 0.0022, 1, 0.46, 0.8, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.type = %d\\n' % field_desc.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L332_C4", "label": "context()", "type": "expression", "loc": [332, 332], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "vector": [8, 1, 0.7378, 0.0022, 1, 0.46, 0.8667, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.cpp_type = %d\\n\\n' % CPP_TYPE[field_desc.type])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L333_C4", "label": "append()", "type": "expression", "loc": [333, 333], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "vector": [8, 1, 0.74, 0.0022, 1, 0.46, 0.9333, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " env.context.append(context.getvalue())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L334_C4", "label": "return", "type": "return", "loc": [334, 334], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "vector": [13, 1, 0.7422, 0.0022, 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_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "label": "code_gen_message", "type": "function", "loc": [336, 382], "level": 0, "parent": null, "vector": [2, 0, 0.7978, 0.1044, 0, 0.66, 0.8333, 937, 0, 3, 1, 0, 0, 0, 35], "semantic": {"name": "code_gen_message", "arg_names": ["message_descriptor", "env", "containing_type"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def code_gen_message(message_descriptor, env, containing_type = None):\n env.enter(message_descriptor.name)\n full_name = env.get_local_name()\n obj_name = full_name.upper().replace('.', '_')\n env.descriptor.append(\n \"local %s = protobuf.Descriptor();\\n\"% obj_name\n )\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L337_C4", "label": "enter()", "type": "expression", "loc": [337, 337], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [8, 1, 0.7489, 0.0022, 1, 0.04, 0.0, 196, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "enter", "arg_names": [], "import_names": [], "rhs_call_name": "enter", "annotation": ""}, "snippet": " env.enter(message_descriptor.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L338_C4", "label": "full_name = get_local_name()", "type": "assigned_variable", "loc": [338, 338], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [14, 1, 0.7511, 0.0022, 1, 0.04, 0.0417, 869, 3, 0, 0, 0, 996, 10, 1], "semantic": {"name": "full_name", "arg_names": [], "import_names": [], "rhs_call_name": "get_local_name", "annotation": ""}, "snippet": " full_name = env.get_local_name()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L339_C4", "label": "obj_name = replace()", "type": "assigned_variable", "loc": [339, 339], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [14, 1, 0.7533, 0.0022, 1, 0.04, 0.0833, 412, 3, 2, 0, 0, 293, 10, 2], "semantic": {"name": "obj_name", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " obj_name = full_name.upper().replace('.', '_')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L340_C4", "label": "append()", "type": "expression", "loc": [340, 342], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [8, 1, 0.7578, 0.0067, 1, 0.04, 0.125, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " env.descriptor.append(\n \"local %s = protobuf.Descriptor();\\n\"% obj_name\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L344_C4", "label": "context = Writer()", "type": "assigned_variable", "loc": [344, 344], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [14, 1, 0.7644, 0.0022, 1, 0.04, 0.1667, 954, 3, 1, 0, 0, 839, 10, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "Writer", "annotation": ""}, "snippet": " context = Writer(obj_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L345_C4", "label": "context()", "type": "expression", "loc": [345, 345], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [8, 1, 0.7667, 0.0022, 1, 0.04, 0.2083, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.name = \"%s\"\\n' % message_descriptor.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L346_C4", "label": "context()", "type": "expression", "loc": [346, 346], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [8, 1, 0.7689, 0.0022, 1, 0.04, 0.25, 954, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.full_name = \"%s\"\\n' % env.get_global_name())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L348_C4", "label": "nested_types =", "type": "assigned_variable", "loc": [348, 348], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [14, 1, 0.7733, 0.0022, 1, 0.04, 0.2917, 821, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "nested_types", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nested_types = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L349_C4", "label": "for msg_desc", "type": "for", "loc": [349, 351], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [6, 1, 0.7778, 0.0067, 1, 0.04, 0.3333, 525, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "msg_desc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for msg_desc in message_descriptor.nested_type:\n msg_name = code_gen_message(msg_desc, env, obj_name)\n nested_types.append(msg_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L350_C8", "label": "msg_name = code_gen_message()", "type": "assigned_variable", "loc": [350, 350], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L349_C4", "vector": [14, 2, 0.7778, 0.0022, 2, 0.93, 0.0, 631, 3, 3, 0, 0, 937, 10, 1], "semantic": {"name": "msg_name", "arg_names": [], "import_names": [], "rhs_call_name": "code_gen_message", "annotation": ""}, "snippet": " msg_name = code_gen_message(msg_desc, env, obj_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L351_C8", "label": "append()", "type": "expression", "loc": [351, 351], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L349_C4", "vector": [8, 2, 0.78, 0.0022, 2, 0.93, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " nested_types.append(msg_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L352_C4", "label": "context()", "type": "expression", "loc": [352, 352], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [8, 1, 0.7822, 0.0022, 1, 0.04, 0.375, 954, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.nested_types = {%s}\\n' % ', '.join(nested_types))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L354_C4", "label": "enums =", "type": "assigned_variable", "loc": [354, 354], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [14, 1, 0.7867, 0.0022, 1, 0.04, 0.4167, 146, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "enums", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " enums = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L355_C4", "label": "for enum_desc", "type": "for", "loc": [355, 356], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [6, 1, 0.79, 0.0044, 1, 0.04, 0.4583, 211, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "enum_desc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for enum_desc in message_descriptor.enum_type:\n enums.append(code_gen_enum(enum_desc, env))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L356_C8", "label": "append()", "type": "expression", "loc": [356, 356], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L355_C4", "vector": [8, 2, 0.7911, 0.0022, 2, 0.58, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " enums.append(code_gen_enum(enum_desc, env))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L357_C4", "label": "context()", "type": "expression", "loc": [357, 357], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [8, 1, 0.7933, 0.0022, 1, 0.04, 0.5, 954, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.enum_types = {%s}\\n' % ', '.join(enums))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L359_C4", "label": "fields =", "type": "assigned_variable", "loc": [359, 359], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [14, 1, 0.7978, 0.0022, 1, 0.04, 0.5417, 358, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "fields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fields = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L360_C4", "label": "for i, field_desc", "type": "for", "loc": [360, 361], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [6, 1, 0.8011, 0.0044, 1, 0.04, 0.5833, 597, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i, field_desc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, field_desc in enumerate(message_descriptor.field):\n fields.append(code_gen_field(i, field_desc, env))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L361_C8", "label": "append()", "type": "expression", "loc": [361, 361], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L360_C4", "vector": [8, 2, 0.8022, 0.0022, 2, 0.36, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " fields.append(code_gen_field(i, field_desc, env))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L363_C4", "label": "context()", "type": "expression", "loc": [363, 363], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [8, 1, 0.8067, 0.0022, 1, 0.04, 0.625, 954, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.fields = {%s}\\n' % ', '.join(fields))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L364_C4", "label": "if", "type": "if", "loc": [364, 367], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [4, 1, 0.8122, 0.0089, 1, 0.04, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(message_descriptor.extension_range) > 0:\n context('.is_extendable = true\\n')\n else:\n context('.is_extendable = false\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L365_C8", "label": "context()", "type": "expression", "loc": [365, 365], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L364_C4", "vector": [8, 2, 0.8111, 0.0022, 2, 0.56, 0.0, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.is_extendable = true\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L367_C8", "label": "context()", "type": "expression", "loc": [367, 367], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L364_C4", "vector": [8, 2, 0.8156, 0.0022, 2, 0.56, 1.0, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.is_extendable = false\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L369_C4", "label": "extensions =", "type": "assigned_variable", "loc": [369, 369], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [14, 1, 0.82, 0.0022, 1, 0.04, 0.7083, 866, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "extensions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extensions = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L370_C4", "label": "for i, field_desc", "type": "for", "loc": [370, 371], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [6, 1, 0.8233, 0.0044, 1, 0.04, 0.75, 597, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i, field_desc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, field_desc in enumerate(message_descriptor.extension):\n extensions.append(code_gen_field(i, field_desc, env))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L371_C8", "label": "append()", "type": "expression", "loc": [371, 371], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L370_C4", "vector": [8, 2, 0.8244, 0.0022, 2, 0.38, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " extensions.append(code_gen_field(i, field_desc, env))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L372_C4", "label": "context()", "type": "expression", "loc": [372, 372], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [8, 1, 0.8267, 0.0022, 1, 0.04, 0.7917, 954, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.extensions = {%s}\\n' % ', '.join(extensions))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L374_C4", "label": "if", "type": "if", "loc": [374, 375], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [4, 1, 0.8322, 0.0044, 1, 0.04, 0.8333, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if containing_type:\n context('.containing_type = %s\\n' % containing_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L375_C8", "label": "context()", "type": "expression", "loc": [375, 375], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L374_C4", "vector": [8, 2, 0.8333, 0.0022, 2, 0.9, 0.0, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "context", "annotation": ""}, "snippet": " context('.containing_type = %s\\n' % containing_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L377_C4", "label": "append()", "type": "expression", "loc": [377, 378], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [8, 1, 0.8389, 0.0044, 1, 0.04, 0.875, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " env.message.append('%s = protobuf.Message(%s)\\n' % (full_name,\n obj_name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L380_C4", "label": "append()", "type": "expression", "loc": [380, 380], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [8, 1, 0.8444, 0.0022, 1, 0.04, 0.9167, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " env.context.append(context.getvalue())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L381_C4", "label": "exit()", "type": "expression", "loc": [381, 381], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [8, 1, 0.8467, 0.0022, 1, 0.04, 0.9583, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " env.exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L382_C4", "label": "return", "type": "return", "loc": [382, 382], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "vector": [13, 1, 0.8489, 0.0022, 1, 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_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L384_C0", "label": "write_header", "type": "function", "loc": [384, 386], "level": 0, "parent": null, "vector": [2, 0, 0.8556, 0.0067, 0, 0.66, 0.875, 152, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write_header", "arg_names": ["writer"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def write_header(writer):\n writer(\"\"\"-- Generated By protoc-gen-lua Do not Edit\n\"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L385_C4", "label": "writer()", "type": "expression", "loc": [385, 386], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L384_C0", "vector": [8, 1, 0.8567, 0.0044, 1, 0.84, 0.0, 614, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "writer", "arg_names": [], "import_names": [], "rhs_call_name": "writer", "annotation": ""}, "snippet": " writer(\"\"\"-- Generated By protoc-gen-lua Do not Edit\n\"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L388_C0", "label": "code_gen_file", "type": "function", "loc": [388, 428], "level": 0, "parent": null, "vector": [2, 0, 0.9067, 0.0911, 0, 0.66, 0.9167, 616, 0, 3, 0, 0, 0, 0, 23], "semantic": {"name": "code_gen_file", "arg_names": ["proto_file", "env", "is_gen"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def code_gen_file(proto_file, env, is_gen):\n filename = path.splitext(proto_file.name)[0]\n env.enter_file(filename, proto_file.package)\n\n includes = []\n for f in proto_file.dependency:\n inc_file = path.splitext(f)[0]\n includes.append(inc_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L389_C4", "label": "filename =", "type": "assigned_variable", "loc": [389, 389], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L388_C0", "vector": [14, 1, 0.8644, 0.0022, 1, 0.56, 0.0, 275, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = path.splitext(proto_file.name)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L390_C4", "label": "enter_file()", "type": "expression", "loc": [390, 390], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L388_C0", "vector": [8, 1, 0.8667, 0.0022, 1, 0.56, 0.1429, 739, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "enter_file", "arg_names": [], "import_names": [], "rhs_call_name": "enter_file", "annotation": ""}, "snippet": " env.enter_file(filename, proto_file.package)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L392_C4", "label": "includes =", "type": "assigned_variable", "loc": [392, 392], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L388_C0", "vector": [14, 1, 0.8711, 0.0022, 1, 0.56, 0.2857, 671, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "includes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " includes = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L393_C4", "label": "for f", "type": "for", "loc": [393, 395], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L388_C0", "vector": [6, 1, 0.8756, 0.0067, 1, 0.56, 0.4286, 899, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for f in proto_file.dependency:\n inc_file = path.splitext(f)[0]\n includes.append(inc_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L394_C8", "label": "inc_file =", "type": "assigned_variable", "loc": [394, 394], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L393_C4", "vector": [14, 2, 0.8756, 0.0022, 2, 0.55, 0.0, 942, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "inc_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " inc_file = path.splitext(f)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L395_C8", "label": "append()", "type": "expression", "loc": [395, 395], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L393_C4", "vector": [8, 2, 0.8778, 0.0022, 2, 0.55, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " includes.append(inc_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L400_C4", "label": "for enum_desc", "type": "for", "loc": [400, 404], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L388_C0", "vector": [6, 1, 0.8933, 0.0111, 1, 0.56, 0.5714, 211, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "enum_desc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for enum_desc in proto_file.enum_type:\n code_gen_enum(enum_desc, env)\n for enum_value in enum_desc.value:\n env.message.append('%s = %d\\n' % (enum_value.name,\n enum_value.number))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L401_C8", "label": "code_gen_enum()", "type": "expression", "loc": [401, 401], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L400_C4", "vector": [8, 2, 0.8911, 0.0022, 2, 0.83, 0.0, 768, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "code_gen_enum", "arg_names": [], "import_names": [], "rhs_call_name": "code_gen_enum", "annotation": ""}, "snippet": " code_gen_enum(enum_desc, env)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L402_C8", "label": "for enum_value", "type": "for", "loc": [402, 404], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L400_C4", "vector": [6, 2, 0.8956, 0.0067, 2, 0.83, 1.0, 497, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "enum_value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for enum_value in enum_desc.value:\n env.message.append('%s = %d\\n' % (enum_value.name,\n enum_value.number))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L403_C12", "label": "append()", "type": "expression", "loc": [403, 404], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L402_C8", "vector": [8, 3, 0.8967, 0.0044, 3, 0.99, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " env.message.append('%s = %d\\n' % (enum_value.name,\n enum_value.number))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L406_C4", "label": "for msg_desc", "type": "for", "loc": [406, 407], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L388_C0", "vector": [6, 1, 0.9033, 0.0044, 1, 0.56, 0.7143, 525, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "msg_desc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for msg_desc in proto_file.message_type:\n code_gen_message(msg_desc, env)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L407_C8", "label": "code_gen_message()", "type": "expression", "loc": [407, 407], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L406_C4", "vector": [8, 2, 0.9044, 0.0022, 2, 0.81, 0.0, 937, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "code_gen_message", "arg_names": [], "import_names": [], "rhs_call_name": "code_gen_message", "annotation": ""}, "snippet": " code_gen_message(msg_desc, env)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "label": "if", "type": "if", "loc": [409, 427], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L388_C0", "vector": [4, 1, 0.9289, 0.0422, 1, 0.56, 0.8571, 0, 2, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if is_gen:\n lua = Writer()\n write_header(lua)\n lua('local protobuf = require \"protobuf\"\\n')\n for i in includes:\n lua('local %s_pb = require(\"%s_pb\")\\n' % (i, i))\n lua(\"module('%s_pb')\\n\" % env.filename)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L410_C8", "label": "lua = Writer()", "type": "assigned_variable", "loc": [410, 410], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "vector": [14, 2, 0.9111, 0.0022, 2, 0.58, 0.0, 34, 3, 0, 0, 0, 839, 10, 1], "semantic": {"name": "lua", "arg_names": [], "import_names": [], "rhs_call_name": "Writer", "annotation": ""}, "snippet": " lua = Writer()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L411_C8", "label": "write_header()", "type": "expression", "loc": [411, 411], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "vector": [8, 2, 0.9133, 0.0022, 2, 0.58, 0.0714, 152, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write_header", "arg_names": [], "import_names": [], "rhs_call_name": "write_header", "annotation": ""}, "snippet": " write_header(lua)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L412_C8", "label": "lua()", "type": "expression", "loc": [412, 412], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "vector": [8, 2, 0.9156, 0.0022, 2, 0.58, 0.1429, 34, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "lua", "arg_names": [], "import_names": [], "rhs_call_name": "lua", "annotation": ""}, "snippet": " lua('local protobuf = require \"protobuf\"\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L413_C8", "label": "for i", "type": "for", "loc": [413, 414], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "vector": [6, 2, 0.9189, 0.0044, 2, 0.58, 0.2143, 826, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in includes:\n lua('local %s_pb = require(\"%s_pb\")\\n' % (i, i))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L414_C12", "label": "lua()", "type": "expression", "loc": [414, 414], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L413_C8", "vector": [8, 3, 0.92, 0.0022, 3, 0.69, 0.0, 34, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "lua", "arg_names": [], "import_names": [], "rhs_call_name": "lua", "annotation": ""}, "snippet": " lua('local %s_pb = require(\"%s_pb\")\\n' % (i, i))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L415_C8", "label": "lua()", "type": "expression", "loc": [415, 415], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "vector": [8, 2, 0.9222, 0.0022, 2, 0.58, 0.2857, 34, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "lua", "arg_names": [], "import_names": [], "rhs_call_name": "lua", "annotation": ""}, "snippet": " lua(\"module('%s_pb')\\n\" % env.filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L417_C8", "label": "lua()", "type": "expression", "loc": [417, 417], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "vector": [8, 2, 0.9267, 0.0022, 2, 0.58, 0.3571, 34, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "lua", "arg_names": [], "import_names": [], "rhs_call_name": "lua", "annotation": ""}, "snippet": " lua('\\n\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L418_C8", "label": "map()", "type": "expression", "loc": [418, 418], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "vector": [8, 2, 0.9289, 0.0022, 2, 0.58, 0.4286, 53, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "map", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " map(lua, env.descriptor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L419_C8", "label": "lua()", "type": "expression", "loc": [419, 419], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "vector": [8, 2, 0.9311, 0.0022, 2, 0.58, 0.5, 34, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "lua", "arg_names": [], "import_names": [], "rhs_call_name": "lua", "annotation": ""}, "snippet": " lua('\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L420_C8", "label": "map()", "type": "expression", "loc": [420, 420], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "vector": [8, 2, 0.9333, 0.0022, 2, 0.58, 0.5714, 53, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "map", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " map(lua, env.context)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L421_C8", "label": "lua()", "type": "expression", "loc": [421, 421], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "vector": [8, 2, 0.9356, 0.0022, 2, 0.58, 0.6429, 34, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "lua", "arg_names": [], "import_names": [], "rhs_call_name": "lua", "annotation": ""}, "snippet": " lua('\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L422_C8", "label": "sort()", "type": "expression", "loc": [422, 422], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "vector": [8, 2, 0.9378, 0.0022, 2, 0.58, 0.7143, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " env.message.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L423_C8", "label": "map()", "type": "expression", "loc": [423, 423], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "vector": [8, 2, 0.94, 0.0022, 2, 0.58, 0.7857, 53, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "map", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " map(lua, env.message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L424_C8", "label": "lua()", "type": "expression", "loc": [424, 424], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "vector": [8, 2, 0.9422, 0.0022, 2, 0.58, 0.8571, 34, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "lua", "arg_names": [], "import_names": [], "rhs_call_name": "lua", "annotation": ""}, "snippet": " lua('\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L425_C8", "label": "map()", "type": "expression", "loc": [425, 425], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "vector": [8, 2, 0.9444, 0.0022, 2, 0.58, 0.9286, 53, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "map", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " map(lua, env.register)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L427_C8", "label": " = getvalue()", "type": "assigned_variable", "loc": [427, 427], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "vector": [14, 2, 0.9489, 0.0022, 2, 0.58, 1.0, 0, 3, 0, 0, 0, 626, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "getvalue", "annotation": ""}, "snippet": " _files[env.filename+ '_pb.lua'] = lua.getvalue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L428_C4", "label": "exit_file()", "type": "expression", "loc": [428, 428], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L388_C0", "vector": [8, 1, 0.9511, 0.0022, 1, 0.56, 1.0, 520, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit_file", "arg_names": [], "import_names": [], "rhs_call_name": "exit_file", "annotation": ""}, "snippet": " env.exit_file()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L430_C0", "label": "main", "type": "function", "loc": [430, 446], "level": 0, "parent": null, "vector": [2, 0, 0.9733, 0.0378, 0, 0.66, 0.9583, 624, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n plugin_require_bin = sys.stdin.read()\n code_gen_req = plugin_pb2.CodeGeneratorRequest()\n code_gen_req.ParseFromString(plugin_require_bin)\n\n env = Env()\n for proto_file in code_gen_req.proto_file:\n code_gen_file(proto_file, env,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L431_C4", "label": "plugin_require_bin = read()", "type": "assigned_variable", "loc": [431, 431], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L430_C0", "vector": [14, 1, 0.9578, 0.0022, 1, 0.0, 0.0, 938, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "plugin_require_bin", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " plugin_require_bin = sys.stdin.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L432_C4", "label": "code_gen_req = CodeGeneratorRequest()", "type": "assigned_variable", "loc": [432, 432], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L430_C0", "vector": [14, 1, 0.96, 0.0022, 1, 0.0, 0.1429, 573, 3, 0, 0, 0, 743, 10, 1], "semantic": {"name": "code_gen_req", "arg_names": [], "import_names": [], "rhs_call_name": "CodeGeneratorRequest", "annotation": ""}, "snippet": " code_gen_req = plugin_pb2.CodeGeneratorRequest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L433_C4", "label": "ParseFromString()", "type": "expression", "loc": [433, 433], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L430_C0", "vector": [8, 1, 0.9622, 0.0022, 1, 0.0, 0.2857, 330, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ParseFromString", "arg_names": [], "import_names": [], "rhs_call_name": "ParseFromString", "annotation": ""}, "snippet": " code_gen_req.ParseFromString(plugin_require_bin)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L435_C4", "label": "env = Env()", "type": "assigned_variable", "loc": [435, 435], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L430_C0", "vector": [14, 1, 0.9667, 0.0022, 1, 0.0, 0.4286, 803, 3, 0, 0, 0, 510, 10, 1], "semantic": {"name": "env", "arg_names": [], "import_names": [], "rhs_call_name": "Env", "annotation": ""}, "snippet": " env = Env()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L436_C4", "label": "for proto_file", "type": "for", "loc": [436, 438], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L430_C0", "vector": [6, 1, 0.9711, 0.0067, 1, 0.0, 0.5714, 176, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "proto_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for proto_file in code_gen_req.proto_file:\n code_gen_file(proto_file, env,\n proto_file.name in code_gen_req.file_to_generate)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L437_C8", "label": "code_gen_file()", "type": "expression", "loc": [437, 438], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L436_C4", "vector": [8, 2, 0.9722, 0.0044, 2, 0.15, 0.0, 616, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "code_gen_file", "arg_names": [], "import_names": [], "rhs_call_name": "code_gen_file", "annotation": ""}, "snippet": " code_gen_file(proto_file, env,\n proto_file.name in code_gen_req.file_to_generate)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L440_C4", "label": "code_generated = CodeGeneratorResponse()", "type": "assigned_variable", "loc": [440, 440], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L430_C0", "vector": [14, 1, 0.9778, 0.0022, 1, 0.0, 0.7143, 801, 3, 0, 0, 0, 513, 10, 1], "semantic": {"name": "code_generated", "arg_names": [], "import_names": [], "rhs_call_name": "CodeGeneratorResponse", "annotation": ""}, "snippet": " code_generated = plugin_pb2.CodeGeneratorResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L441_C4", "label": "for k", "type": "for", "loc": [441, 444], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L430_C0", "vector": [6, 1, 0.9833, 0.0089, 1, 0.0, 0.8571, 954, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k in _files:\n file_desc = code_generated.file.add()\n file_desc.name = k\n file_desc.content = _files[k]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L442_C8", "label": "file_desc = add()", "type": "assigned_variable", "loc": [442, 442], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L441_C4", "vector": [14, 2, 0.9822, 0.0022, 2, 0.03, 0.0, 386, 3, 0, 0, 0, 241, 10, 1], "semantic": {"name": "file_desc", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " file_desc = code_generated.file.add()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L443_C8", "label": "file_desc.name =", "type": "assigned_variable", "loc": [443, 443], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L441_C4", "vector": [14, 2, 0.9844, 0.0022, 2, 0.03, 0.5, 543, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "file_desc.name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " file_desc.name = k"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L444_C8", "label": "file_desc.content =", "type": "assigned_variable", "loc": [444, 444], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L441_C4", "vector": [14, 2, 0.9867, 0.0022, 2, 0.03, 1.0, 385, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "file_desc.content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " file_desc.content = _files[k]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L446_C4", "label": "write()", "type": "expression", "loc": [446, 446], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L430_C0", "vector": [8, 1, 0.9911, 0.0022, 1, 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": " sys.stdout.write(code_generated.SerializeToString())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L448_C0", "label": "if", "type": "if", "loc": [448, 449], "level": 0, "parent": null, "vector": [4, 0, 0.9967, 0.0044, 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_1363:Expr_L449_C4", "label": "main()", "type": "expression", "loc": [449, 449], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L448_C0", "vector": [8, 1, 0.9978, 0.0022, 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": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Import_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L83_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L84_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L84_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L85_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L85_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L86_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L83_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L89_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L92_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L93_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L93_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L94_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:While_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:While_L100_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:While_L100_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:While_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:While_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L112_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:While_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L113_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L143_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Try_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:Try_L147_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L148_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:Try_L147_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L151_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L152_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L158_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L159_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L158_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L161_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L164_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L165_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L168_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L169_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L168_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L170_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L170_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L171_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L170_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L173_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L186_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L202_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L203_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L203_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L204_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L205_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L207_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L211_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L207_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L213_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L213_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L214_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L207_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L216_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L216_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L207_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L220_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L221_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:ClassDef_L207_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L223_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L223_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L224_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L223_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L225_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L225_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L226_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L223_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L227_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L249_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L250_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L249_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L251_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L249_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L252_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L249_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L256_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L249_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L257_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L249_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L258_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L249_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L259_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L249_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L261_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L249_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L265_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L266_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L267_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L268_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L272_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L273_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L274_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L276_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L277_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L277_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L278_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L279_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L281_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L282_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L283_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L286_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L287_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L288_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L292_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L294_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L297_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L298_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L299_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L301_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L301_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L302_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L301_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L303_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L301_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L304_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L304_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L305_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L304_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L307_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L301_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L309_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L301_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L310_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L310_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L311_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L310_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L312_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L312_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L313_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L312_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L315_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L301_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L316_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L318_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L318_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L319_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L318_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L320_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L320_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L321_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L320_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L323_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L325_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L326_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L327_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L331_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L332_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L333_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L337_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L338_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L339_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L340_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L344_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L345_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L346_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L348_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L349_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L349_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L350_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L349_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L351_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L352_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L354_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L355_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L355_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L356_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L357_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L359_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L360_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L360_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L361_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L363_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L364_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L364_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L365_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L364_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L367_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L369_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L370_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L370_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L371_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L372_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L374_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L374_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L375_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L377_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L380_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L381_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Return_L382_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L384_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L385_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L388_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L389_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L388_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L390_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L388_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L392_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L388_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L393_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L393_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L394_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L393_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L395_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L388_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L400_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L400_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L401_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L400_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L402_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L402_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L403_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L388_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L406_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L406_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L407_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L388_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L410_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L411_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L412_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L413_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L413_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L414_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L415_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L417_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L418_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L419_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L420_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L421_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L422_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L423_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L424_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L425_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L427_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L388_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L428_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L430_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L431_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L430_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L432_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L430_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L433_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L430_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L435_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L430_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L436_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L436_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L437_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L430_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L440_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L430_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L441_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L441_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L442_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L441_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L443_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:For_L441_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Assign_L444_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:FunctionDef_L430_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L446_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1363:If_L448_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1363:Expr_L449_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_1364 | 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_1364: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_1364: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_1364: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_1364: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_1364: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_1364:Expr_L13_C2", "label": "expression", "type": "expression", "loc": [13, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L12_C0", "vector": [8, 1, 0.1596, 0.0532, 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 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_1364:Assign_L18_C2", "label": "process = Popen()", "type": "assigned_variable", "loc": [18, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L12_C0", "vector": [14, 1, 0.2074, 0.0426, 1, 0.14, 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_1364:Assign_L22_C2", "label": "output =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L12_C0", "vector": [14, 1, 0.234, 0.0106, 1, 0.14, 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_1364:Return_L23_C2", "label": "return", "type": "return", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L12_C0", "vector": [13, 1, 0.2447, 0.0106, 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 output.splitlines()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1364: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_1364:Expr_L27_C2", "label": "expression", "type": "expression", "loc": [27, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L26_C0", "vector": [8, 1, 0.3191, 0.0745, 1, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n 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_1364:Assign_L35_C2", "label": "output_lines = _GetOutputLines()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L26_C0", "vector": [14, 1, 0.3723, 0.0106, 1, 0.79, 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_1364:Assign_L38_C2", "label": "line_revs =", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L26_C0", "vector": [14, 1, 0.4043, 0.0106, 1, 0.79, 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_1364:For_L39_C2", "label": "for line", "type": "for", "loc": [39, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L26_C0", "vector": [6, 1, 0.4415, 0.0638, 1, 0.79, 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_1364:Assign_L40_C4", "label": "rev_match = match()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L39_C2", "vector": [14, 2, 0.4255, 0.0106, 2, 0.29, 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_1364:If_L41_C4", "label": "if", "type": "if", "loc": [41, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L39_C2", "vector": [4, 2, 0.4415, 0.0213, 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 not rev_match:\n raise 'Unexpected line of output from hg: %s' % line"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1364:Assign_L43_C4", "label": "rev_hash = group()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L39_C2", "vector": [14, 2, 0.4574, 0.0106, 2, 0.29, 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_1364:Expr_L44_C4", "label": "append()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L39_C2", "vector": [8, 2, 0.4681, 0.0106, 2, 0.29, 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_1364:For_L46_C2", "label": "for str", "type": "for", "loc": [46, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L26_C0", "vector": [6, 1, 0.5745, 0.1809, 1, 0.79, 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_1364:Assign_L48_C4", "label": "start_line =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L46_C2", "vector": [14, 2, 0.5106, 0.0106, 2, 0.91, 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_1364:Assign_L49_C4", "label": "end_line =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L46_C2", "vector": [14, 2, 0.5213, 0.0106, 2, 0.91, 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_1364:Assign_L52_C4", "label": "revs =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L46_C2", "vector": [14, 2, 0.5532, 0.0106, 2, 0.91, 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_1364:For_L53_C4", "label": "for line_number", "type": "for", "loc": [53, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L46_C2", "vector": [6, 2, 0.5691, 0.0213, 2, 0.91, 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_1364:Expr_L54_C6", "label": "append()", "type": "expression", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L53_C4", "vector": [8, 3, 0.5745, 0.0106, 3, 0.9, 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_1364:If_L58_C4", "label": "if", "type": "if", "loc": [58, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L46_C2", "vector": [4, 2, 0.6223, 0.0213, 2, 0.91, 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_1364:Assign_L62_C4", "label": " = frozenset()", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L46_C2", "vector": [14, 2, 0.6596, 0.0106, 2, 0.91, 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_1364: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_1364:Expr_L65_C2", "label": "expression", "type": "expression", "loc": [65, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L64_C0", "vector": [8, 1, 0.7394, 0.1064, 1, 0.29, 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_1364:If_L75_C2", "label": "if", "type": "if", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L64_C0", "vector": [4, 1, 0.8032, 0.0213, 1, 0.29, 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_1364:Return_L76_C4", "label": "return", "type": "return", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:If_L75_C2", "vector": [13, 2, 0.8085, 0.0106, 2, 0.22, 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_1364:Assign_L79_C2", "label": "args =", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L64_C0", "vector": [14, 1, 0.8404, 0.0106, 1, 0.29, 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_1364:Assign_L80_C2", "label": "output_lines = _GetOutputLines()", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L64_C0", "vector": [14, 1, 0.8511, 0.0106, 1, 0.29, 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_1364:Return_L82_C2", "label": "return", "type": "return", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L64_C0", "vector": [13, 1, 0.8723, 0.0106, 1, 0.29, 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_1364: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_1364:Expr_L85_C2", "label": "expression", "type": "expression", "loc": [85, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L84_C0", "vector": [8, 1, 0.9362, 0.0745, 1, 0.22, 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_1364:If_L92_C2", "label": "if", "type": "if", "loc": [92, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L84_C0", "vector": [4, 1, 0.984, 0.0213, 1, 0.22, 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_1364:Return_L93_C4", "label": "return", "type": "return", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:If_L92_C2", "vector": [13, 2, 0.9894, 0.0106, 2, 0.49, 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_1364:Return_L94_C2", "label": "return", "type": "return", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L84_C0", "vector": [13, 1, 1.0, 0.0106, 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 rev2"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Expr_L13_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Assign_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Return_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Expr_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Assign_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:If_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Expr_L54_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:If_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Expr_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:If_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:If_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Return_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Assign_L79_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Assign_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Return_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Expr_L85_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:If_L92_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:If_L92_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1364:Return_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1364:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1364: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_1365 | 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_1365: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_1365: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_1365: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_1365: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_1365: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_1365: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_1365:Expr_L14_C2", "label": "print()", "type": "expression", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L13_C0", "vector": [8, 1, 0.1458, 0.0104, 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('Usage: %s <command> [<language> ...]\\n' % sys.argv[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1365:Expr_L15_C2", "label": "print()", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L13_C0", "vector": [8, 1, 0.1562, 0.0104, 1, 0.23, 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_1365:Expr_L16_C2", "label": "print()", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L13_C0", "vector": [8, 1, 0.1667, 0.0104, 1, 0.23, 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_1365:Expr_L17_C2", "label": "print()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L13_C0", "vector": [8, 1, 0.1771, 0.0104, 1, 0.23, 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_1365:Expr_L18_C2", "label": "print()", "type": "expression", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L13_C0", "vector": [8, 1, 0.1875, 0.0104, 1, 0.23, 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_1365:Expr_L19_C2", "label": "exit()", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L13_C0", "vector": [8, 1, 0.1979, 0.0104, 1, 0.23, 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_1365: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_1365:Expr_L23_C2", "label": "expression", "type": "expression", "loc": [23, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L22_C0", "vector": [8, 1, 0.2656, 0.0625, 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 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_1365:Assign_L29_C2", "label": "validator = Validator()", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L22_C0", "vector": [14, 1, 0.3021, 0.0104, 1, 0.17, 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_1365:Expr_L30_C2", "label": "Validate()", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L22_C0", "vector": [8, 1, 0.3125, 0.0104, 1, 0.17, 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_1365:Assign_L31_C2", "label": "missing = missing_in_lang()", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L22_C0", "vector": [14, 1, 0.3229, 0.0104, 1, 0.17, 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_1365:Assign_L32_C2", "label": "outdated = outdated_in_lang()", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L22_C0", "vector": [14, 1, 0.3333, 0.0104, 1, 0.17, 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_1365:For_L34_C2", "label": "for lang", "type": "for", "loc": [34, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L22_C0", "vector": [6, 1, 0.3906, 0.0833, 1, 0.17, 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_1365:Assign_L35_C4", "label": "untranslated =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L34_C2", "vector": [14, 2, 0.3646, 0.0104, 2, 0.6, 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_1365:If_L37_C4", "label": "if", "type": "if", "loc": [37, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L34_C2", "vector": [4, 2, 0.3906, 0.0208, 2, 0.6, 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_1365:Assign_L40_C4", "label": "translator = Translator()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L34_C2", "vector": [14, 2, 0.4167, 0.0104, 2, 0.6, 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_1365:Expr_L41_C4", "label": "Translate()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L34_C2", "vector": [8, 2, 0.4271, 0.0104, 2, 0.6, 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_1365: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_1365:Expr_L45_C2", "label": "expression", "type": "expression", "loc": [45, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L44_C0", "vector": [8, 1, 0.4896, 0.0521, 1, 0.9, 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_1365:Assign_L50_C2", "label": "validator = Validator()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L44_C0", "vector": [14, 1, 0.5208, 0.0104, 1, 0.9, 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_1365:Expr_L51_C2", "label": "Validate()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L44_C0", "vector": [8, 1, 0.5312, 0.0104, 1, 0.9, 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_1365:Assign_L53_C2", "label": "error_count =", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L44_C0", "vector": [14, 1, 0.5521, 0.0104, 1, 0.9, 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_1365:If_L54_C2", "label": "if", "type": "if", "loc": [54, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L44_C0", "vector": [4, 1, 0.6198, 0.125, 1, 0.9, 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_1365:Expr_L55_C4", "label": "print()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L54_C2", "vector": [8, 2, 0.5729, 0.0104, 2, 0.47, 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_1365:For_L57_C4", "label": "for lang, missing", "type": "for", "loc": [57, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L54_C2", "vector": [6, 2, 0.6042, 0.0312, 2, 0.47, 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_1365:Expr_L58_C6", "label": "print()", "type": "expression", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L57_C4", "vector": [8, 3, 0.6042, 0.0104, 3, 0.39, 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_1365:Assign_L59_C6", "label": "error_count =", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L57_C4", "vector": [14, 3, 0.6146, 0.0104, 3, 0.39, 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_1365:For_L60_C4", "label": "for lang, missing", "type": "for", "loc": [60, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L54_C2", "vector": [6, 2, 0.6354, 0.0312, 2, 0.47, 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_1365:Expr_L61_C6", "label": "print()", "type": "expression", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L60_C4", "vector": [8, 3, 0.6354, 0.0104, 3, 0.4, 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_1365:Assign_L62_C6", "label": "error_count =", "type": "assigned_variable", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L60_C4", "vector": [14, 3, 0.6458, 0.0104, 3, 0.4, 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_1365:For_L63_C4", "label": "for lang, outdated", "type": "for", "loc": [63, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L54_C2", "vector": [6, 2, 0.6667, 0.0312, 2, 0.47, 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_1365:Expr_L64_C6", "label": "print()", "type": "expression", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L63_C4", "vector": [8, 3, 0.6667, 0.0104, 3, 0.89, 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_1365:Assign_L65_C6", "label": "error_count =", "type": "assigned_variable", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L63_C4", "vector": [14, 3, 0.6771, 0.0104, 3, 0.89, 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_1365:Return_L67_C2", "label": "return", "type": "return", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L44_C0", "vector": [13, 1, 0.6979, 0.0104, 1, 0.9, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return error_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1365: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_1365:Assign_L71_C2", "label": "argv =", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L70_C0", "vector": [14, 1, 0.7396, 0.0104, 1, 0.73, 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_1365:Assign_L72_C2", "label": "argc = len()", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L70_C0", "vector": [14, 1, 0.75, 0.0104, 1, 0.73, 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_1365:If_L73_C2", "label": "if", "type": "if", "loc": [73, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L70_C0", "vector": [4, 1, 0.7656, 0.0208, 1, 0.73, 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_1365:Expr_L74_C4", "label": "Usage()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L73_C2", "vector": [8, 2, 0.7708, 0.0104, 2, 0.12, 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_1365:Assign_L76_C2", "label": "languages = GetAllLanguageFiles()", "type": "assigned_variable", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L70_C0", "vector": [14, 1, 0.7917, 0.0104, 1, 0.73, 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_1365:If_L77_C2", "label": "if", "type": "if", "loc": [77, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L70_C0", "vector": [4, 1, 0.8438, 0.0938, 1, 0.73, 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_1365:Assign_L78_C4", "label": "langs = set()", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L77_C2", "vector": [14, 2, 0.8125, 0.0104, 2, 0.14, 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_1365:If_L79_C4", "label": "if", "type": "if", "loc": [79, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L77_C2", "vector": [4, 2, 0.8281, 0.0208, 2, 0.14, 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_1365:Assign_L83_C4", "label": "languages = dict()", "type": "assigned_variable", "loc": [83, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L77_C2", "vector": [14, 2, 0.875, 0.0312, 2, 0.14, 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_1365:Assign_L87_C2", "label": "cmd =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L70_C0", "vector": [14, 1, 0.9062, 0.0104, 1, 0.73, 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_1365:If_L88_C2", "label": "if", "type": "if", "loc": [88, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L70_C0", "vector": [4, 1, 0.9479, 0.0729, 1, 0.73, 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_1365:Expr_L89_C4", "label": "Translate()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L88_C2", "vector": [8, 2, 0.9271, 0.0104, 2, 0.63, 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_1365:If_L90_C2", "label": "if", "type": "if", "loc": [90, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L88_C2", "vector": [4, 2, 0.9583, 0.0521, 2, 0.63, 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_1365:Assign_L91_C4", "label": "error_count = Validate()", "type": "assigned_variable", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L90_C2", "vector": [14, 3, 0.9479, 0.0104, 3, 0.3, 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_1365:Expr_L93_C4", "label": "Usage()", "type": "expression", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L90_C2", "vector": [8, 3, 0.9688, 0.0104, 3, 0.3, 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_1365:Assign_L94_C4", "label": "error_count =", "type": "assigned_variable", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L90_C2", "vector": [14, 3, 0.9792, 0.0104, 3, 0.3, 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_1365:Expr_L96_C2", "label": "print()", "type": "expression", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L70_C0", "vector": [8, 1, 1.0, 0.0104, 1, 0.73, 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_1365:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Expr_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Expr_L15_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Expr_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Expr_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Expr_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Expr_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Expr_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Assign_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Expr_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Assign_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Assign_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Expr_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Assign_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Expr_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Expr_L58_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Assign_L59_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Expr_L61_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Assign_L62_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Expr_L64_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:For_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Assign_L65_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Return_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Assign_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Assign_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L73_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Assign_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Expr_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1365:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1365:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1365: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_1366 | 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_1366: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_1366: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_1366:Expr_L10_C2", "label": "expression", "type": "expression", "loc": [10, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1366:ClassDef_L9_C0", "vector": [8, 1, 0.5238, 0.1429, 1, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n classdocs\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1366:FunctionDef_L14_C2", "label": "__init__", "type": "function", "loc": [14, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1366:ClassDef_L9_C0", "vector": [2, 1, 0.7619, 0.2381, 1, 0.79, 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_1366:Expr_L15_C4", "label": "expression", "type": "expression", "loc": [15, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1366:FunctionDef_L14_C2", "vector": [8, 2, 0.7619, 0.1429, 2, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Constructor\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1366:Assign_L18_C4", "label": "self._language =", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1366:FunctionDef_L14_C2", "vector": [14, 2, 0.8571, 0.0476, 2, 0.17, 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_1366:FunctionDef_L20_C2", "label": "Translate", "type": "function", "loc": [20, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1366:ClassDef_L9_C0", "vector": [2, 1, 0.9762, 0.0952, 1, 0.79, 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_1366:Expr_L21_C4", "label": "print()", "type": "expression", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1366:FunctionDef_L20_C2", "vector": [8, 2, 1.0, 0.0476, 2, 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(string_names)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1366:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1366:Expr_L10_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1366:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1366:FunctionDef_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1366:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1366:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1366:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1366:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1366:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1366:FunctionDef_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1366:FunctionDef_L20_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1366: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_1367 | 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_1367: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_1367: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_1367: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_1367: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_1367: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_1367:FunctionDef_L14_C2", "label": "__init__", "type": "function", "loc": [14, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:ClassDef_L12_C0", "vector": [2, 1, 0.2174, 0.2, 1, 0.71, 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_1367:Expr_L15_C4", "label": "expression", "type": "expression", "loc": [15, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L14_C2", "vector": [8, 2, 0.1522, 0.0522, 2, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n 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_1367:Assign_L21_C4", "label": "self._langs =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L14_C2", "vector": [14, 2, 0.1826, 0.0087, 2, 0.16, 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_1367:Assign_L22_C4", "label": "self._master =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L14_C2", "vector": [14, 2, 0.1913, 0.0087, 2, 0.16, 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_1367:Assign_L23_C4", "label": "self._language_paths =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L14_C2", "vector": [14, 2, 0.2, 0.0087, 2, 0.16, 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_1367:Assign_L25_C4", "label": "parser = StringsParser()", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L14_C2", "vector": [14, 2, 0.2174, 0.0087, 2, 0.16, 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_1367:For_L26_C4", "label": "for lang, lang_dir", "type": "for", "loc": [26, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L14_C2", "vector": [6, 2, 0.2609, 0.0783, 2, 0.16, 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_1367:Assign_L27_C6", "label": "filename = join()", "type": "assigned_variable", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L26_C4", "vector": [14, 3, 0.2348, 0.0087, 3, 0.31, 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_1367:Assign_L28_C6", "label": "parsed_file = Parse()", "type": "assigned_variable", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L26_C4", "vector": [14, 3, 0.2435, 0.0087, 3, 0.31, 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_1367:Expr_L29_C6", "label": "FillMercurialRevisions()", "type": "expression", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L26_C4", "vector": [8, 3, 0.2522, 0.0087, 3, 0.31, 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_1367:If_L31_C6", "label": "if", "type": "if", "loc": [31, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L26_C4", "vector": [4, 3, 0.2826, 0.0348, 3, 0.31, 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_1367:Assign_L32_C8", "label": "self._master =", "type": "assigned_variable", "loc": [32, 32], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L31_C6", "vector": [14, 4, 0.2783, 0.0087, 4, 0.02, 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_1367:Assign_L34_C8", "label": "assign", "type": "assigned_variable", "loc": [34, 34], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L31_C6", "vector": [14, 4, 0.2957, 0.0087, 4, 0.02, 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_1367:Expr_L36_C4", "label": "_Reset()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L14_C2", "vector": [8, 2, 0.313, 0.0087, 2, 0.16, 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_1367:FunctionDef_L38_C2", "label": "Validate", "type": "function", "loc": [38, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:ClassDef_L12_C0", "vector": [2, 1, 0.3565, 0.0609, 1, 0.71, 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_1367:Expr_L39_C4", "label": "expression", "type": "expression", "loc": [39, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L38_C2", "vector": [8, 2, 0.3478, 0.0261, 2, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Computes whether all the data in the files for the given languages is valid.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1367:Expr_L42_C4", "label": "_Reset()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L38_C2", "vector": [8, 2, 0.3652, 0.0087, 2, 0.08, 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_1367:Expr_L43_C4", "label": "_ValidateMissingKeys()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L38_C2", "vector": [8, 2, 0.3739, 0.0087, 2, 0.08, 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_1367:Expr_L44_C4", "label": "_ValidateOutdatedKeys()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L38_C2", "vector": [8, 2, 0.3826, 0.0087, 2, 0.08, 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_1367:FunctionDef_L46_C2", "label": "valid", "type": "function", "loc": [46, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:ClassDef_L12_C0", "vector": [2, 1, 0.413, 0.0348, 1, 0.71, 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_1367:Return_L47_C4", "label": "return", "type": "return", "loc": [47, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L46_C2", "vector": [13, 2, 0.4174, 0.0261, 2, 0.51, 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_1367:FunctionDef_L51_C2", "label": "missing_in_master", "type": "function", "loc": [51, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:ClassDef_L12_C0", "vector": [2, 1, 0.4478, 0.0174, 1, 0.71, 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_1367:Return_L52_C4", "label": "return", "type": "return", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L51_C2", "vector": [13, 2, 0.4522, 0.0087, 2, 0.84, 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_1367:FunctionDef_L54_C2", "label": "missing_in_lang", "type": "function", "loc": [54, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:ClassDef_L12_C0", "vector": [2, 1, 0.4739, 0.0174, 1, 0.71, 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_1367:Return_L55_C4", "label": "return", "type": "return", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L54_C2", "vector": [13, 2, 0.4783, 0.0087, 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._missing_in_lang"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L57_C2", "label": "outdated_in_lang", "type": "function", "loc": [57, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:ClassDef_L12_C0", "vector": [2, 1, 0.5, 0.0174, 1, 0.71, 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_1367:Return_L58_C4", "label": "return", "type": "return", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L57_C2", "vector": [13, 2, 0.5043, 0.0087, 2, 0.45, 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_1367:FunctionDef_L60_C2", "label": "_Reset", "type": "function", "loc": [60, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:ClassDef_L12_C0", "vector": [2, 1, 0.5391, 0.0435, 1, 0.71, 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_1367:Assign_L62_C4", "label": "self._missing_in_master =", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L60_C2", "vector": [14, 2, 0.5391, 0.0087, 2, 0.37, 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_1367:Assign_L63_C4", "label": "self._missing_in_lang =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L60_C2", "vector": [14, 2, 0.5478, 0.0087, 2, 0.37, 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_1367:Assign_L64_C4", "label": "self._outdated_in_lang =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L60_C2", "vector": [14, 2, 0.5565, 0.0087, 2, 0.37, 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_1367:FunctionDef_L66_C2", "label": "_ValidateMissingKeys", "type": "function", "loc": [66, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:ClassDef_L12_C0", "vector": [2, 1, 0.6304, 0.1217, 1, 0.71, 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_1367:Expr_L67_C4", "label": "expression", "type": "expression", "loc": [67, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L66_C2", "vector": [8, 2, 0.5913, 0.0261, 2, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Computes whether there are missing keys on either side.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L70_C4", "label": "master_keys = frozenset()", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L66_C2", "vector": [14, 2, 0.6087, 0.0087, 2, 0.33, 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_1367:For_L71_C4", "label": "for lang, file", "type": "for", "loc": [71, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L66_C2", "vector": [6, 2, 0.6522, 0.0783, 2, 0.33, 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_1367:Assign_L72_C6", "label": "keys = frozenset()", "type": "assigned_variable", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L71_C4", "vector": [14, 3, 0.6261, 0.0087, 3, 0.93, 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_1367:Assign_L73_C6", "label": "missing_in_master =", "type": "assigned_variable", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L71_C4", "vector": [14, 3, 0.6348, 0.0087, 3, 0.93, 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_1367:Assign_L74_C6", "label": "missing_in_lang =", "type": "assigned_variable", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L71_C4", "vector": [14, 3, 0.6435, 0.0087, 3, 0.93, 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_1367:If_L76_C6", "label": "if", "type": "if", "loc": [76, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L71_C4", "vector": [4, 3, 0.6652, 0.0174, 3, 0.93, 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_1367:Assign_L77_C8", "label": "assign", "type": "assigned_variable", "loc": [77, 77], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L76_C6", "vector": [14, 4, 0.6696, 0.0087, 4, 0.82, 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_1367:If_L78_C6", "label": "if", "type": "if", "loc": [78, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L71_C4", "vector": [4, 3, 0.6826, 0.0174, 3, 0.93, 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_1367:Assign_L79_C8", "label": "assign", "type": "assigned_variable", "loc": [79, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L78_C6", "vector": [14, 4, 0.687, 0.0087, 4, 0.71, 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_1367:FunctionDef_L81_C2", "label": "_ValidateOutdatedKeys", "type": "function", "loc": [81, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:ClassDef_L12_C0", "vector": [2, 1, 0.8522, 0.3043, 1, 0.71, 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_1367:Expr_L82_C4", "label": "expression", "type": "expression", "loc": [82, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L81_C2", "vector": [8, 2, 0.7261, 0.0348, 2, 0.02, 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_1367:For_L86_C4", "label": "for lang, file", "type": "for", "loc": [86, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L81_C2", "vector": [6, 2, 0.8739, 0.2609, 2, 0.02, 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_1367:Assign_L87_C6", "label": "outdated =", "type": "assigned_variable", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L86_C4", "vector": [14, 3, 0.7565, 0.0087, 3, 0.09, 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_1367:For_L88_C6", "label": "for key, str", "type": "for", "loc": [88, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L86_C4", "vector": [6, 3, 0.8696, 0.2174, 3, 0.09, 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_1367:Assign_L91_C8", "label": "master_str =", "type": "assigned_variable", "loc": [91, 91], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L88_C6", "vector": [14, 4, 0.7913, 0.0087, 4, 0.25, 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_1367:Assign_L92_C8", "label": "master_revs =", "type": "assigned_variable", "loc": [92, 92], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L88_C6", "vector": [14, 4, 0.8, 0.0087, 4, 0.25, 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_1367:Assign_L93_C8", "label": "lang_revs =", "type": "assigned_variable", "loc": [93, 93], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L88_C6", "vector": [14, 4, 0.8087, 0.0087, 4, 0.25, 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_1367:If_L94_C8", "label": "if", "type": "if", "loc": [94, 96], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L88_C6", "vector": [4, 4, 0.8261, 0.0261, 4, 0.25, 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_1367:Expr_L95_C10", "label": "print()", "type": "expression", "loc": [95, 95], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L94_C8", "vector": [8, 5, 0.8261, 0.0087, 5, 0.04, 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_1367:Assign_L98_C8", "label": "master_file = join()", "type": "assigned_variable", "loc": [98, 98], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L88_C6", "vector": [14, 4, 0.8522, 0.0087, 4, 0.25, 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_1367:Assign_L99_C8", "label": "lang_file = join()", "type": "assigned_variable", "loc": [99, 99], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L88_C6", "vector": [14, 4, 0.8609, 0.0087, 4, 0.25, 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_1367:Assign_L103_C8", "label": "master_rev = reduce()", "type": "assigned_variable", "loc": [103, 105], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L88_C6", "vector": [14, 4, 0.9043, 0.0261, 4, 0.25, 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_1367:Assign_L106_C8", "label": "lang_rev = reduce()", "type": "assigned_variable", "loc": [106, 108], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L88_C6", "vector": [14, 4, 0.9304, 0.0261, 4, 0.25, 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_1367:If_L111_C8", "label": "if", "type": "if", "loc": [111, 112], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L88_C6", "vector": [4, 4, 0.9696, 0.0174, 4, 0.25, 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_1367:Expr_L112_C10", "label": "append()", "type": "expression", "loc": [112, 112], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L111_C8", "vector": [8, 5, 0.9739, 0.0087, 5, 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": " outdated.append(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L114_C6", "label": "if", "type": "if", "loc": [114, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L86_C4", "vector": [4, 3, 0.9957, 0.0174, 3, 0.09, 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_1367:Assign_L115_C8", "label": "assign", "type": "assigned_variable", "loc": [115, 115], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L114_C6", "vector": [14, 4, 1.0, 0.0087, 4, 0.26, 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_1367:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L27_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L28_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Expr_L29_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L31_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L31_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L31_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Expr_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Return_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L51_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Return_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Return_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Return_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L72_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L73_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L74_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L76_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L76_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L78_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L78_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L81_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Expr_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:FunctionDef_L81_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L87_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L88_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Expr_L95_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Assign_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:Expr_L112_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:For_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L114_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1367:If_L114_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1367: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_1368 | 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_1368: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_1368: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_1368: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_1368: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_1368: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_1368: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_1368: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_1368: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_1368:Expr_L16_C2", "label": "expression", "type": "expression", "loc": [16, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L15_C0", "vector": [8, 1, 0.3778, 0.0667, 1, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Returns the directory in which the MyTracks directory is located.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1368:Assign_L19_C2", "label": "path = getcwd()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L15_C0", "vector": [14, 1, 0.4222, 0.0222, 1, 0.03, 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_1368:While_L20_C2", "label": "while", "type": "while", "loc": [20, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L15_C0", "vector": [5, 1, 0.5, 0.1333, 1, 0.03, 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_1368:If_L21_C4", "label": "if", "type": "if", "loc": [21, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1368:While_L20_C2", "vector": [4, 2, 0.4778, 0.0444, 2, 0.62, 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_1368:Assign_L25_C4", "label": "path =", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1368:While_L20_C2", "vector": [14, 2, 0.5556, 0.0222, 2, 0.62, 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_1368:Return_L27_C2", "label": "return", "type": "return", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L15_C0", "vector": [13, 1, 0.6, 0.0222, 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 path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1368: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_1368:Expr_L31_C2", "label": "expression", "type": "expression", "loc": [31, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "vector": [8, 1, 0.7111, 0.0667, 1, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Returns a mapping from all found languages to their respective directories.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1368:Assign_L34_C2", "label": "mytracks_path = GetMyTracksDir()", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "vector": [14, 1, 0.7556, 0.0222, 1, 0.75, 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_1368:Assign_L35_C2", "label": "res_dir = join()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "vector": [14, 1, 0.7778, 0.0222, 1, 0.75, 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_1368:Assign_L36_C2", "label": "language_dirs = glob()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "vector": [14, 1, 0.8, 0.0222, 1, 0.75, 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_1368:Assign_L37_C2", "label": "master_dir = join()", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "vector": [14, 1, 0.8222, 0.0222, 1, 0.75, 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_1368:If_L38_C2", "label": "if", "type": "if", "loc": [38, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "vector": [4, 1, 0.8556, 0.0444, 1, 0.75, 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_1368:If_L40_C2", "label": "if", "type": "if", "loc": [40, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "vector": [4, 1, 0.9, 0.0444, 1, 0.75, 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_1368:Assign_L43_C2", "label": "language_tuples =", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "vector": [14, 1, 0.9556, 0.0222, 1, 0.75, 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_1368:Expr_L44_C2", "label": "append()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "vector": [8, 1, 0.9778, 0.0222, 1, 0.75, 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_1368:Return_L45_C2", "label": "return", "type": "return", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "vector": [13, 1, 1.0, 0.0222, 1, 0.75, 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_1368:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1368:Expr_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1368:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1368:While_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1368:While_L20_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1368:If_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1368:While_L20_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1368:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1368:Return_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1368:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1368:Assign_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1368:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1368:Assign_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1368:Assign_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1368:If_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1368:If_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1368:Assign_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1368:Expr_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1368:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1368: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_1369 | 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_1369: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_1369: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_1369: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_1369: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_1369:Expr_L12_C2", "label": "expression", "type": "expression", "loc": [12, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:ClassDef_L11_C0", "vector": [8, 1, 0.1261, 0.0522, 1, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n 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_1369:FunctionDef_L19_C2", "label": "Parse", "type": "function", "loc": [19, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:ClassDef_L11_C0", "vector": [2, 1, 0.3, 0.2783, 1, 0.82, 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_1369:Expr_L20_C4", "label": "expression", "type": "expression", "loc": [20, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "vector": [8, 2, 0.2435, 0.1478, 2, 0.96, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n 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_1369:Expr_L37_C4", "label": "_Reset()", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "vector": [8, 2, 0.3217, 0.0087, 2, 0.96, 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_1369:Assign_L40_C4", "label": "self._xml_parser = ParserCreate()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "vector": [14, 2, 0.3478, 0.0087, 2, 0.96, 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_1369:Assign_L41_C4", "label": "self._xml_parser.StartElementHandler =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "vector": [14, 2, 0.3565, 0.0087, 2, 0.96, 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_1369:Assign_L42_C4", "label": "self._xml_parser.EndElementHandler =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "vector": [14, 2, 0.3652, 0.0087, 2, 0.96, 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_1369:Assign_L43_C4", "label": "self._xml_parser.CharacterDataHandler =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "vector": [14, 2, 0.3739, 0.0087, 2, 0.96, 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_1369:Assign_L44_C4", "label": "self._xml_parser.CommentHandler =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "vector": [14, 2, 0.3826, 0.0087, 2, 0.96, 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_1369:Assign_L46_C4", "label": "file_obj = open()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "vector": [14, 2, 0.4, 0.0087, 2, 0.96, 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_1369:Expr_L47_C4", "label": "ParseFile()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "vector": [8, 2, 0.4087, 0.0087, 2, 0.96, 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_1369:Expr_L48_C4", "label": "close()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "vector": [8, 2, 0.4174, 0.0087, 2, 0.96, 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_1369:Return_L50_C4", "label": "return", "type": "return", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "vector": [13, 2, 0.4348, 0.0087, 2, 0.96, 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_1369:FunctionDef_L52_C2", "label": "_Reset", "type": "function", "loc": [52, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:ClassDef_L11_C0", "vector": [2, 1, 0.4696, 0.0435, 1, 0.82, 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_1369:Assign_L53_C4", "label": "self._currentString =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L52_C2", "vector": [14, 2, 0.4609, 0.0087, 2, 0.21, 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_1369:Assign_L54_C4", "label": "self._currentStringName =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L52_C2", "vector": [14, 2, 0.4696, 0.0087, 2, 0.21, 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_1369:Assign_L55_C4", "label": "self._currentStringValue =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L52_C2", "vector": [14, 2, 0.4783, 0.0087, 2, 0.21, 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_1369:Assign_L56_C4", "label": "self._all_strings =", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L52_C2", "vector": [14, 2, 0.487, 0.0087, 2, 0.21, 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_1369:FunctionDef_L58_C2", "label": "_StartElementHandler", "type": "function", "loc": [58, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:ClassDef_L11_C0", "vector": [2, 1, 0.5783, 0.1565, 1, 0.82, 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_1369:If_L59_C4", "label": "if", "type": "if", "loc": [59, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L58_C2", "vector": [4, 2, 0.5174, 0.0174, 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 name != 'string':\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1369:Return_L60_C6", "label": "return", "type": "return", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L59_C4", "vector": [13, 3, 0.5217, 0.0087, 3, 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_1369:If_L62_C4", "label": "if", "type": "if", "loc": [62, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L58_C2", "vector": [4, 2, 0.5435, 0.0174, 2, 0.49, 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_1369:Return_L63_C6", "label": "return", "type": "return", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L62_C4", "vector": [13, 3, 0.5478, 0.0087, 3, 0.29, 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_1369:Assign_L67_C4", "label": "self._currentString =", "type": "assigned_variable", "loc": [67, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L58_C2", "vector": [14, 2, 0.5913, 0.0261, 2, 0.49, 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_1369:If_L71_C4", "label": "if", "type": "if", "loc": [71, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L58_C2", "vector": [4, 2, 0.6217, 0.0174, 2, 0.49, 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_1369:Assign_L72_C6", "label": "assign", "type": "assigned_variable", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L71_C4", "vector": [14, 3, 0.6261, 0.0087, 3, 0.05, 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_1369:Assign_L74_C4", "label": "self._currentStringName =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L58_C2", "vector": [14, 2, 0.6435, 0.0087, 2, 0.49, 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_1369:Assign_L75_C4", "label": "self._currentStringValue =", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L58_C2", "vector": [14, 2, 0.6522, 0.0087, 2, 0.49, 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_1369:FunctionDef_L77_C2", "label": "_EndElementHandler", "type": "function", "loc": [77, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:ClassDef_L11_C0", "vector": [2, 1, 0.7217, 0.113, 1, 0.82, 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_1369:If_L78_C4", "label": "if", "type": "if", "loc": [78, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L77_C2", "vector": [4, 2, 0.6826, 0.0174, 2, 0.66, 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_1369:Return_L79_C6", "label": "return", "type": "return", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L78_C4", "vector": [13, 3, 0.687, 0.0087, 3, 0.81, 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_1369:Assign_L83_C4", "label": "assign", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L77_C2", "vector": [14, 2, 0.7217, 0.0087, 2, 0.66, 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_1369:Assign_L84_C4", "label": "assign", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L77_C2", "vector": [14, 2, 0.7304, 0.0087, 2, 0.66, 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_1369:Assign_L85_C4", "label": "assign", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L77_C2", "vector": [14, 2, 0.7391, 0.0087, 2, 0.66, 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_1369:Assign_L87_C4", "label": "self._currentString =", "type": "assigned_variable", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L77_C2", "vector": [14, 2, 0.7565, 0.0087, 2, 0.66, 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_1369:Assign_L88_C4", "label": "self._currentStringName =", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L77_C2", "vector": [14, 2, 0.7652, 0.0087, 2, 0.66, 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_1369:Assign_L89_C4", "label": "self._currentStringValue =", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L77_C2", "vector": [14, 2, 0.7739, 0.0087, 2, 0.66, 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_1369:FunctionDef_L91_C2", "label": "_CharacterDataHandler", "type": "function", "loc": [91, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:ClassDef_L11_C0", "vector": [2, 1, 0.8087, 0.0435, 1, 0.82, 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_1369:If_L92_C4", "label": "if", "type": "if", "loc": [92, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L91_C2", "vector": [4, 2, 0.8043, 0.0174, 2, 0.82, 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_1369:Return_L93_C6", "label": "return", "type": "return", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L92_C4", "vector": [13, 3, 0.8087, 0.0087, 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_1369:Assign_L97_C2", "label": "_KEEP_PARENT_REGEX = compile()", "type": "assigned_variable", "loc": [97, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:ClassDef_L11_C0", "vector": [14, 1, 0.8565, 0.0348, 1, 0.82, 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_1369:FunctionDef_L102_C2", "label": "_CommentHandler", "type": "function", "loc": [102, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:ClassDef_L11_C0", "vector": [2, 1, 0.9435, 0.1217, 1, 0.82, 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_1369:Assign_L103_C4", "label": "keep_parent_match = match()", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L102_C2", "vector": [14, 2, 0.8957, 0.0087, 2, 0.23, 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_1369:If_L104_C4", "label": "if", "type": "if", "loc": [104, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L102_C2", "vector": [4, 2, 0.9087, 0.0174, 2, 0.23, 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_1369:Return_L105_C6", "label": "return", "type": "return", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L104_C4", "vector": [13, 3, 0.913, 0.0087, 3, 0.19, 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_1369:Assign_L107_C4", "label": "name = group()", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L102_C2", "vector": [14, 2, 0.9304, 0.0087, 2, 0.23, 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_1369:Assign_L108_C4", "label": "assign", "type": "assigned_variable", "loc": [108, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L102_C2", "vector": [14, 2, 0.9565, 0.0435, 2, 0.23, 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_1369:Assign_L113_C4", "label": "rev = group()", "type": "assigned_variable", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L102_C2", "vector": [14, 2, 0.9826, 0.0087, 2, 0.23, 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_1369:If_L114_C4", "label": "if", "type": "if", "loc": [114, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L102_C2", "vector": [4, 2, 0.9957, 0.0174, 2, 0.23, 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_1369:Assign_L115_C6", "label": "assign", "type": "assigned_variable", "loc": [115, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L114_C4", "vector": [14, 3, 1.0, 0.0087, 3, 0.47, 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_1369:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Expr_L12_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Return_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Return_L60_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Return_L63_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L72_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Return_L79_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Return_L93_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L97_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L102_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Return_L105_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1369:If_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1369:Assign_L115_C6"}] |
#!/usr/bin/python
import os
def main():
lists = [
"ISODrivers/Galaxy/galaxy.prx",
"ISODrivers/March33/march33.prx",
"ISODrivers/March33/march33_620.prx",
"ISODrivers/Inferno/inferno.prx",
"Popcorn/popcorn.prx",
"Satelite/satelite.prx",
"Stargate/stargate.prx",
"SystemControl/systemctrl.prx",
"contrib/usbdevice.prx",
"Vshctrl/vshctrl.prx",
"Recovery/recovery.prx",
]
for fn in lists:
path = "../" + fn
name=os.path.split(fn)[-1]
name=os.path.splitext(name)[0]
ret = os.system("bin2c %s %s.h %s"%(path, name, name))
assert(ret == 0)
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_1370 | 10 | 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_1370:Import_L3_C0", "label": "os import os", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1071, 0.0357, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1370:FunctionDef_L5_C0", "label": "main", "type": "function", "loc": [5, 25], "level": 0, "parent": null, "vector": [2, 0, 0.5357, 0.75, 0, 0.66, 0.5, 624, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n\tlists = [\n\t\t\t\"ISODrivers/Galaxy/galaxy.prx\",\n\t\t\t\"ISODrivers/March33/march33.prx\",\n\t\t\t\"ISODrivers/March33/march33_620.prx\",\n\t\t\t\"ISODrivers/Inferno/inferno.prx\",\n\t\t\t\"Popcorn/popcorn.prx\",\n\t\t\t\"Satelite/satelite.prx\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1370:Assign_L6_C1", "label": "lists =", "type": "assigned_variable", "loc": [6, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1370:FunctionDef_L5_C0", "vector": [14, 1, 0.4286, 0.4643, 1, 0.91, 0.0, 194, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "lists", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tlists = [\n\t\t\t\"ISODrivers/Galaxy/galaxy.prx\",\n\t\t\t\"ISODrivers/March33/march33.prx\",\n\t\t\t\"ISODrivers/March33/march33_620.prx\",\n\t\t\t\"ISODrivers/Inferno/inferno.prx\",\n\t\t\t\"Popcorn/popcorn.prx\",\n\t\t\t\"Satelite/satelite.prx\",\n\t\t\t\"Stargate/stargate.prx\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1370:For_L20_C1", "label": "for fn", "type": "for", "loc": [20, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1370:FunctionDef_L5_C0", "vector": [6, 1, 0.8036, 0.2143, 1, 0.91, 1.0, 59, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "fn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor fn in lists:\n\t\tpath = \"../\" + fn\n\t\tname=os.path.split(fn)[-1]\n\t\tname=os.path.splitext(name)[0]\n\t\tret = os.system(\"bin2c %s %s.h %s\"%(path, name, name))\n\t\tassert(ret == 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1370:Assign_L21_C2", "label": "path =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1370:For_L20_C1", "vector": [14, 2, 0.75, 0.0357, 2, 0.83, 0.0, 358, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tpath = \"../\" + fn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1370:Assign_L22_C2", "label": "name =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1370:For_L20_C1", "vector": [14, 2, 0.7857, 0.0357, 2, 0.83, 0.3333, 57, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tname=os.path.split(fn)[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1370:Assign_L23_C2", "label": "name =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1370:For_L20_C1", "vector": [14, 2, 0.8214, 0.0357, 2, 0.83, 0.6667, 57, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tname=os.path.splitext(name)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1370:Assign_L24_C2", "label": "ret = system()", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1370:For_L20_C1", "vector": [14, 2, 0.8571, 0.0357, 2, 0.83, 1.0, 501, 3, 1, 0, 0, 856, 10, 1], "semantic": {"name": "ret", "arg_names": [], "import_names": [], "rhs_call_name": "system", "annotation": ""}, "snippet": "\t\tret = os.system(\"bin2c %s %s.h %s\"%(path, name, name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1370:If_L27_C0", "label": "if", "type": "if", "loc": [27, 28], "level": 0, "parent": null, "vector": [4, 0, 0.9821, 0.0714, 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\tmain()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1370:Expr_L28_C1", "label": "main()", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1370:If_L27_C0", "vector": [8, 1, 1.0, 0.0357, 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": "\tmain()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1370:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1370:Assign_L6_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1370:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1370:For_L20_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1370:For_L20_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1370:Assign_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1370:For_L20_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1370:Assign_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1370:For_L20_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1370:Assign_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1370:For_L20_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1370:Assign_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1370:If_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1370:Expr_L28_C1"}] |
#!/usr/bin/python
class FakeTime:
def time(self):
return 1225856967.109
import os, gzip, StringIO
gzip.time = FakeTime()
def create_gzip(input, output):
f_in=open(input, 'rb')
temp=StringIO.StringIO()
f=gzip.GzipFile(fileobj=temp, mode='wb')
f.writelines(f_in)
f.close()
f_in.close()
fout=open(output, 'wb')
temp.seek(0)
fout.writelines(temp)
fout.close()
temp.close()
def cleanup():
del_list = [
"installer.prx.gz",
"Rebootex.prx.gz",
]
for file in del_list:
try:
os.remove(file)
except OSError:
pass
def main():
create_gzip("../../Installer/installer.prx", "installer.prx.gz")
create_gzip("../../Rebootex/Rebootex.prx", "Rebootex.prx.gz")
os.system("bin2c installer.prx.gz installer.h installer")
os.system("bin2c Rebootex.prx.gz Rebootex_prx.h Rebootex_prx")
cleanup()
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_1371 | 30 | 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_1371:ClassDef_L3_C0", "label": "FakeTime", "type": "class", "loc": [3, 5], "level": 0, "parent": null, "vector": [3, 0, 0.0909, 0.0682, 0, 0.66, 0.0, 425, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "FakeTime", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FakeTime:\n def time(self):\n return 1225856967.109"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L4_C4", "label": "time", "type": "function", "loc": [4, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:ClassDef_L3_C0", "vector": [2, 1, 0.1023, 0.0455, 1, 0.28, 0.0, 654, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "time", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def time(self):\n return 1225856967.109"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Return_L5_C8", "label": "return", "type": "return", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L4_C4", "vector": [13, 2, 0.1136, 0.0227, 2, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 1225856967.109"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Import_L7_C0", "label": "os import os, gzip, StringIO", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1591, 0.0227, 0, 0.66, 0.1667, 688, 0, 3, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "gzip", "StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os, gzip, StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Assign_L9_C0", "label": "gzip.time = FakeTime()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.2045, 0.0227, 0, 0.66, 0.3333, 7, 3, 0, 0, 0, 425, 10, 1], "semantic": {"name": "gzip.time", "arg_names": [], "import_names": [], "rhs_call_name": "FakeTime", "annotation": ""}, "snippet": "gzip.time = FakeTime()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "label": "create_gzip", "type": "function", "loc": [11, 22], "level": 0, "parent": null, "vector": [2, 0, 0.375, 0.2727, 0, 0.66, 0.5, 716, 0, 2, 0, 0, 0, 0, 11], "semantic": {"name": "create_gzip", "arg_names": ["input", "output"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_gzip(input, output):\n\tf_in=open(input, 'rb')\n\ttemp=StringIO.StringIO()\n\tf=gzip.GzipFile(fileobj=temp, mode='wb')\n\tf.writelines(f_in)\n\tf.close()\n\tf_in.close()\n\tfout=open(output, 'wb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Assign_L12_C1", "label": "f_in = open()", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "vector": [14, 1, 0.2727, 0.0227, 1, 0.64, 0.0, 7, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f_in", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "\tf_in=open(input, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Assign_L13_C1", "label": "temp = StringIO()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "vector": [14, 1, 0.2955, 0.0227, 1, 0.64, 0.1, 915, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "temp", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": "\ttemp=StringIO.StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Assign_L14_C1", "label": "f = GzipFile()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "vector": [14, 1, 0.3182, 0.0227, 1, 0.64, 0.2, 899, 3, 2, 0, 0, 940, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "GzipFile", "annotation": ""}, "snippet": "\tf=gzip.GzipFile(fileobj=temp, mode='wb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L15_C1", "label": "writelines()", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "vector": [8, 1, 0.3409, 0.0227, 1, 0.64, 0.3, 290, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "writelines", "arg_names": [], "import_names": [], "rhs_call_name": "writelines", "annotation": ""}, "snippet": "\tf.writelines(f_in)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L16_C1", "label": "close()", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "vector": [8, 1, 0.3636, 0.0227, 1, 0.64, 0.4, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\tf.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L17_C1", "label": "close()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "vector": [8, 1, 0.3864, 0.0227, 1, 0.64, 0.5, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\tf_in.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Assign_L18_C1", "label": "fout = open()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "vector": [14, 1, 0.4091, 0.0227, 1, 0.64, 0.6, 190, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fout", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "\tfout=open(output, 'wb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L19_C1", "label": "seek()", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "vector": [8, 1, 0.4318, 0.0227, 1, 0.64, 0.7, 66, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "seek", "arg_names": [], "import_names": [], "rhs_call_name": "seek", "annotation": ""}, "snippet": "\ttemp.seek(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L20_C1", "label": "writelines()", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "vector": [8, 1, 0.4545, 0.0227, 1, 0.64, 0.8, 290, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "writelines", "arg_names": [], "import_names": [], "rhs_call_name": "writelines", "annotation": ""}, "snippet": "\tfout.writelines(temp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L21_C1", "label": "close()", "type": "expression", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "vector": [8, 1, 0.4773, 0.0227, 1, 0.64, 0.9, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\tfout.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L22_C1", "label": "close()", "type": "expression", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "vector": [8, 1, 0.5, 0.0227, 1, 0.64, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\ttemp.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L24_C0", "label": "cleanup", "type": "function", "loc": [24, 34], "level": 0, "parent": null, "vector": [2, 0, 0.6591, 0.25, 0, 0.66, 0.6667, 656, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "cleanup", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def cleanup():\n\tdel_list = [\n\t\t\"installer.prx.gz\",\n\t\t\"Rebootex.prx.gz\",\n\t]\n\n\tfor file in del_list:\n\t\ttry:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Assign_L25_C1", "label": "del_list =", "type": "assigned_variable", "loc": [25, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L24_C0", "vector": [14, 1, 0.6023, 0.0909, 1, 0.71, 0.0, 503, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "del_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdel_list = [\n\t\t\"installer.prx.gz\",\n\t\t\"Rebootex.prx.gz\",\n\t]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:For_L30_C1", "label": "for file", "type": "for", "loc": [30, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L24_C0", "vector": [6, 1, 0.7273, 0.1136, 1, 0.71, 1.0, 107, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor file in del_list:\n\t\ttry:\n\t\t\tos.remove(file)\n\t\texcept OSError:\n\t\t\tpass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Try_L31_C2", "label": "try", "type": "try", "loc": [31, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:For_L30_C1", "vector": [7, 2, 0.7386, 0.0909, 2, 0.69, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ttry:\n\t\t\tos.remove(file)\n\t\texcept OSError:\n\t\t\tpass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L32_C3", "label": "remove()", "type": "expression", "loc": [32, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:Try_L31_C2", "vector": [8, 3, 0.7273, 0.0227, 3, 0.82, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": "\t\t\tos.remove(file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L36_C0", "label": "main", "type": "function", "loc": [36, 41], "level": 0, "parent": null, "vector": [2, 0, 0.875, 0.1364, 0, 0.66, 0.8333, 624, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n\tcreate_gzip(\"../../Installer/installer.prx\", \"installer.prx.gz\")\n\tcreate_gzip(\"../../Rebootex/Rebootex.prx\", \"Rebootex.prx.gz\")\n\tos.system(\"bin2c installer.prx.gz installer.h installer\")\n\tos.system(\"bin2c Rebootex.prx.gz Rebootex_prx.h Rebootex_prx\")\n\tcleanup()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L37_C1", "label": "create_gzip()", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L36_C0", "vector": [8, 1, 0.8409, 0.0227, 1, 0.8, 0.0, 716, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "create_gzip", "arg_names": [], "import_names": [], "rhs_call_name": "create_gzip", "annotation": ""}, "snippet": "\tcreate_gzip(\"../../Installer/installer.prx\", \"installer.prx.gz\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L38_C1", "label": "create_gzip()", "type": "expression", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L36_C0", "vector": [8, 1, 0.8636, 0.0227, 1, 0.8, 0.25, 716, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "create_gzip", "arg_names": [], "import_names": [], "rhs_call_name": "create_gzip", "annotation": ""}, "snippet": "\tcreate_gzip(\"../../Rebootex/Rebootex.prx\", \"Rebootex.prx.gz\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L39_C1", "label": "system()", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L36_C0", "vector": [8, 1, 0.8864, 0.0227, 1, 0.8, 0.5, 856, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "system", "arg_names": [], "import_names": [], "rhs_call_name": "system", "annotation": ""}, "snippet": "\tos.system(\"bin2c installer.prx.gz installer.h installer\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L40_C1", "label": "system()", "type": "expression", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L36_C0", "vector": [8, 1, 0.9091, 0.0227, 1, 0.8, 0.75, 856, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "system", "arg_names": [], "import_names": [], "rhs_call_name": "system", "annotation": ""}, "snippet": "\tos.system(\"bin2c Rebootex.prx.gz Rebootex_prx.h Rebootex_prx\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L41_C1", "label": "cleanup()", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L36_C0", "vector": [8, 1, 0.9318, 0.0227, 1, 0.8, 1.0, 656, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "cleanup", "arg_names": [], "import_names": [], "rhs_call_name": "cleanup", "annotation": ""}, "snippet": "\tcleanup()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371: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\tmain()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L44_C1", "label": "main()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1371:If_L43_C0", "vector": [8, 1, 1.0, 0.0227, 1, 0.0, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": "\tmain()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1371:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Return_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Assign_L12_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Assign_L13_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Assign_L14_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L15_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L16_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L17_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Assign_L18_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L19_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L20_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L21_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L22_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Assign_L25_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:For_L30_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:For_L30_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Try_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:Try_L31_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L32_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L37_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L38_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L39_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L40_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L41_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1371:If_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1371:Expr_L44_C1"}] |
#!/usr/bin/python
from hashlib import *
import sys, struct
def sha512(psid):
if len(psid) != 16:
return "".encode()
for i in range(512):
psid = sha1(psid).digest()
return psid
def get_psid(str):
if len(str) != 32:
return "".encode()
b = "".encode()
for i in range(0, len(str), 2):
b += struct.pack('B', int(str[i] + str[i+1], 16))
return b
def main():
if len(sys.argv) < 2:
print ("Usage: sha512.py psid")
exit(0)
psid = get_psid(sys.argv[1])
xhash = sha512(psid)
if len(xhash) == 0:
print ("wrong PSID")
exit(0)
print ("{\n\t"),
for i in range(len(xhash)):
if i != 0 and i % 8 == 0:
print ("\n\t"),
print ("0x%02X, "%(struct.unpack('B', xhash[i])[0])),
print ("\n},")
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_1372 | 31 | 46 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1372:ImportFrom_L3_C0", "label": "from hashlib import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0652, 0.0217, 0, 0.66, 0.0, 154, 0, 1, 0, 0, 154, 0, 0], "semantic": {"name": "hashlib", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hashlib import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:Import_L4_C0", "label": "sys import sys, struct", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.087, 0.0217, 0, 0.66, 0.2, 509, 0, 2, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys", "struct"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys, struct"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L6_C0", "label": "sha512", "type": "function", "loc": [6, 13], "level": 0, "parent": null, "vector": [2, 0, 0.2065, 0.1739, 0, 0.66, 0.4, 135, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "sha512", "arg_names": ["psid"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def sha512(psid):\n\tif len(psid) != 16:\n\t\treturn \"\".encode()\n\n\tfor i in range(512):\n\t\tpsid = sha1(psid).digest()\n\n\treturn psid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L7_C1", "label": "if", "type": "if", "loc": [7, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L6_C0", "vector": [4, 1, 0.163, 0.0435, 1, 0.4, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif len(psid) != 16:\n\t\treturn \"\".encode()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:Return_L8_C2", "label": "return", "type": "return", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L7_C1", "vector": [13, 2, 0.1739, 0.0217, 2, 0.83, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn \"\".encode()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:For_L10_C1", "label": "for i", "type": "for", "loc": [10, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L6_C0", "vector": [6, 1, 0.2283, 0.0435, 1, 0.4, 0.5, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor i in range(512):\n\t\tpsid = sha1(psid).digest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:Assign_L11_C2", "label": "psid = digest()", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:For_L10_C1", "vector": [14, 2, 0.2391, 0.0217, 2, 0.95, 0.0, 357, 3, 0, 0, 0, 142, 10, 2], "semantic": {"name": "psid", "arg_names": [], "import_names": [], "rhs_call_name": "digest", "annotation": ""}, "snippet": "\t\tpsid = sha1(psid).digest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:Return_L13_C1", "label": "return", "type": "return", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L6_C0", "vector": [13, 1, 0.2826, 0.0217, 1, 0.4, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn psid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L15_C0", "label": "get_psid", "type": "function", "loc": [15, 23], "level": 0, "parent": null, "vector": [2, 0, 0.413, 0.1957, 0, 0.66, 0.6, 950, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "get_psid", "arg_names": ["str"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_psid(str):\n\tif len(str) != 32:\n\t\treturn \"\".encode()\n\n\tb = \"\".encode()\n\tfor i in range(0, len(str), 2):\n\t\tb += struct.pack('B', int(str[i] + str[i+1], 16))\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L16_C1", "label": "if", "type": "if", "loc": [16, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L15_C0", "vector": [4, 1, 0.3587, 0.0435, 1, 0.63, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif len(str) != 32:\n\t\treturn \"\".encode()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:Return_L17_C2", "label": "return", "type": "return", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L16_C1", "vector": [13, 2, 0.3696, 0.0217, 2, 0.59, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn \"\".encode()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:Assign_L19_C1", "label": "b = encode()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L15_C0", "vector": [14, 1, 0.413, 0.0217, 1, 0.63, 0.3333, 756, 3, 0, 0, 0, 623, 10, 1], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": "\tb = \"\".encode()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:For_L20_C1", "label": "for i", "type": "for", "loc": [20, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L15_C0", "vector": [6, 1, 0.4457, 0.0435, 1, 0.63, 0.6667, 826, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor i in range(0, len(str), 2):\n\t\tb += struct.pack('B', int(str[i] + str[i+1], 16))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:Return_L23_C1", "label": "return", "type": "return", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L15_C0", "vector": [13, 1, 0.5, 0.0217, 1, 0.63, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn b"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L25_C0", "label": "main", "type": "function", "loc": [25, 43], "level": 0, "parent": null, "vector": [2, 0, 0.7391, 0.413, 0, 0.66, 0.8, 624, 0, 0, 0, 0, 0, 0, 15], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n\tif len(sys.argv) < 2:\n\t\tprint (\"Usage: sha512.py psid\")\n\t\texit(0)\n\t\n\tpsid = get_psid(sys.argv[1])\n\txhash = sha512(psid)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L26_C1", "label": "if", "type": "if", "loc": [26, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L25_C0", "vector": [4, 1, 0.587, 0.0652, 1, 0.85, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif len(sys.argv) < 2:\n\t\tprint (\"Usage: sha512.py psid\")\n\t\texit(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:Expr_L27_C2", "label": "print()", "type": "expression", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L26_C1", "vector": [8, 2, 0.587, 0.0217, 2, 0.36, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint (\"Usage: sha512.py psid\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:Expr_L28_C2", "label": "exit()", "type": "expression", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L26_C1", "vector": [8, 2, 0.6087, 0.0217, 2, 0.36, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\texit(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:Assign_L30_C1", "label": "psid = get_psid()", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L25_C0", "vector": [14, 1, 0.6522, 0.0217, 1, 0.85, 0.1667, 357, 3, 1, 0, 0, 950, 10, 1], "semantic": {"name": "psid", "arg_names": [], "import_names": [], "rhs_call_name": "get_psid", "annotation": ""}, "snippet": "\tpsid = get_psid(sys.argv[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:Assign_L31_C1", "label": "xhash = sha512()", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L25_C0", "vector": [14, 1, 0.6739, 0.0217, 1, 0.85, 0.3333, 141, 3, 1, 0, 0, 135, 10, 1], "semantic": {"name": "xhash", "arg_names": [], "import_names": [], "rhs_call_name": "sha512", "annotation": ""}, "snippet": "\txhash = sha512(psid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L33_C1", "label": "if", "type": "if", "loc": [33, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L25_C0", "vector": [4, 1, 0.7391, 0.0652, 1, 0.85, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif len(xhash) == 0:\n\t\tprint (\"wrong PSID\")\n\t\texit(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:Expr_L34_C2", "label": "print()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L33_C1", "vector": [8, 2, 0.7391, 0.0217, 2, 0.53, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint (\"wrong PSID\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:Expr_L35_C2", "label": "exit()", "type": "expression", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L33_C1", "vector": [8, 2, 0.7609, 0.0217, 2, 0.53, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\texit(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:Expr_L37_C1", "label": "expression", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L25_C0", "vector": [8, 1, 0.8043, 0.0217, 1, 0.85, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tprint (\"{\\n\\t\"),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:For_L39_C1", "label": "for i", "type": "for", "loc": [39, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L25_C0", "vector": [6, 1, 0.8804, 0.087, 1, 0.85, 0.8333, 826, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor i in range(len(xhash)):\n\t\tif i != 0 and i % 8 == 0:\n\t\t\tprint (\"\\n\\t\"),\n\t\tprint (\"0x%02X, \"%(struct.unpack('B', xhash[i])[0])),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L40_C2", "label": "if", "type": "if", "loc": [40, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:For_L39_C1", "vector": [4, 2, 0.8804, 0.0435, 2, 0.54, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif i != 0 and i % 8 == 0:\n\t\t\tprint (\"\\n\\t\"),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:Expr_L41_C3", "label": "expression", "type": "expression", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L40_C2", "vector": [8, 3, 0.8913, 0.0217, 3, 0.27, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tprint (\"\\n\\t\"),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:Expr_L42_C2", "label": "expression", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:For_L39_C1", "vector": [8, 2, 0.913, 0.0217, 2, 0.54, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tprint (\"0x%02X, \"%(struct.unpack('B', xhash[i])[0])),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:Expr_L43_C1", "label": "print()", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L25_C0", "vector": [8, 1, 0.9348, 0.0217, 1, 0.85, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\tprint (\"\\n},\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L45_C0", "label": "if", "type": "if", "loc": [45, 46], "level": 0, "parent": null, "vector": [4, 0, 0.9891, 0.0435, 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\tmain()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1372:Expr_L46_C1", "label": "main()", "type": "expression", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L45_C0", "vector": [8, 1, 1.0, 0.0217, 1, 0.71, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": "\tmain()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L7_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L7_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:Return_L8_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:For_L10_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:For_L10_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:Assign_L11_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:Return_L13_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L16_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:Return_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:Assign_L19_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:For_L20_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:Return_L23_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L26_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L26_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:Expr_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L26_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:Expr_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:Assign_L30_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:Assign_L31_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L33_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L33_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:Expr_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L33_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:Expr_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:Expr_L37_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:For_L39_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:For_L39_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L40_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:Expr_L41_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:For_L39_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:Expr_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:Expr_L43_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1372:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1372:Expr_L46_C1"}] |
#!/usr/bin/python
import sys, hashlib
def toNID(name):
hashstr = hashlib.sha1(name.encode()).hexdigest().upper()
return "0x" + hashstr[6:8] + hashstr[4:6] + hashstr[2:4] + hashstr[0:2]
if __name__ == "__main__":
assert(toNID("sceKernelCpuSuspendIntr") == "0x092968F4")
for name in sys.argv[1:]:
print ("%s: %s"%(name, toNID(name)))
| ajibawa-2023/Python-Code-Large/train/row_1373 | 7 | 13 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1373:Import_L3_C0", "label": "sys import sys, hashlib", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.2308, 0.0769, 0, 0.66, 0.0, 509, 0, 2, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys", "hashlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys, hashlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1373:FunctionDef_L5_C0", "label": "toNID", "type": "function", "loc": [5, 7], "level": 0, "parent": null, "vector": [2, 0, 0.4615, 0.2308, 0, 0.66, 0.5, 259, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "toNID", "arg_names": ["name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def toNID(name):\n\thashstr = hashlib.sha1(name.encode()).hexdigest().upper()\n\treturn \"0x\" + hashstr[6:8] + hashstr[4:6] + hashstr[2:4] + hashstr[0:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1373:Assign_L6_C1", "label": "hashstr = upper()", "type": "assigned_variable", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1373:FunctionDef_L5_C0", "vector": [14, 1, 0.4615, 0.0769, 1, 0.3, 0.0, 235, 3, 0, 0, 0, 347, 10, 4], "semantic": {"name": "hashstr", "arg_names": [], "import_names": [], "rhs_call_name": "upper", "annotation": ""}, "snippet": "\thashstr = hashlib.sha1(name.encode()).hexdigest().upper()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1373:Return_L7_C1", "label": "return", "type": "return", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1373:FunctionDef_L5_C0", "vector": [13, 1, 0.5385, 0.0769, 1, 0.3, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn \"0x\" + hashstr[6:8] + hashstr[4:6] + hashstr[2:4] + hashstr[0:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1373:If_L9_C0", "label": "if", "type": "if", "loc": [9, 13], "level": 0, "parent": null, "vector": [4, 0, 0.8462, 0.3846, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n\tassert(toNID(\"sceKernelCpuSuspendIntr\") == \"0x092968F4\")\n\n\tfor name in sys.argv[1:]:\n\t\tprint (\"%s: %s\"%(name, toNID(name)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1373:For_L12_C1", "label": "for name", "type": "for", "loc": [12, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1373:If_L9_C0", "vector": [6, 1, 0.9615, 0.1538, 1, 0.92, 0.0, 57, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor name in sys.argv[1:]:\n\t\tprint (\"%s: %s\"%(name, toNID(name)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1373:Expr_L13_C2", "label": "print()", "type": "expression", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1373:For_L12_C1", "vector": [8, 2, 1.0, 0.0769, 2, 0.02, 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 (\"%s: %s\"%(name, toNID(name)))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1373:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1373:Assign_L6_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1373:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1373:Return_L7_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1373:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1373:For_L12_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1373:For_L12_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1373:Expr_L13_C2"}] |
#!/usr/bin/python
"""
pspbtcnf_editor: An script that add modules from pspbtcnf
"""
import sys, os, re
from getopt import *
from struct import *
BTCNF_MAGIC=0x0F803001
verbose = False
def print_usage():
print ("%s: pspbtcnf.bin [-o output.bin] [-a add_module_name:before_module_name:flag]" %(os.path.split(sys.argv[0]))[-1])
def replace_binary(data, offset, newdata):
newdata = data[0:offset] + newdata + data[offset+len(newdata):]
assert(len(data) == len(newdata))
return newdata
def dump_binary(data, offset, size):
newdata = data[offset:offset+size]
assert(len(newdata) == size)
return newdata
def dump_binary_str(data, offset):
ch = data[offset]
tmp = b''
while ch != 0:
tmp += pack('b', ch)
offset += 1
ch = data[offset]
return tmp.decode()
def add_prx_to_bootconf(srcfn, before_modname, modname, modflag):
"Return new bootconf data"
fn=open(srcfn, "rb")
bootconf = fn.read()
fn.close()
if len(bootconf) < 64:
raise Exception("Bad bootconf")
signature, devkit, modestart, nmodes, modulestart, nmodules, modnamestart, modnameend = unpack('LL8xLL8xLL8xLL8x', bootconf[:64])
if verbose:
print ("Devkit: 0x%08X"%(devkit))
print ("modestart: 0x%08X"%(modestart))
print ("nmodes: %d"%(nmodes))
print ("modulestart: 0x%08X"%(modulestart))
print ("nmodules: 0x%08X"%(nmodules))
print ("modnamestart: 0x%08X"%(modnamestart))
print ("modnameend: 0x%08X"%(modnameend))
if signature != BTCNF_MAGIC or nmodules <= 0 or nmodes <= 0:
raise Exception("Bad bootconf")
bootconf = bootconf + modname.encode() + b'\0'
modnameend += len(modname) + 1
i=0
while i < nmodules:
module_path, module_flags = unpack('L4xL4x16x', bootconf[modulestart+i*32:modulestart+(i+1)*32])
module_name = dump_binary_str(bootconf, modnamestart+module_path)
if verbose:
print ("[%02d]: Module path: %s flag: 0x%08X"%(i, module_name, module_flags))
if before_modname == module_name:
break
i+=1
if i >= nmodules:
raise Exception("module %s not found"%(before_modname))
module_path = modnameend - len(modname) - 1 - modnamestart
module_flag = 0x80010000 | (modflag & 0xFFFF)
newmod = dump_binary(bootconf, modulestart+i*32, 32)
newmod = replace_binary(newmod, 0, pack('L', module_path))
newmod = replace_binary(newmod, 8, pack('L', module_flag))
bootconf = bootconf[0:modulestart+i*32] + newmod + bootconf[modulestart+i*32:]
nmodules+=1
bootconf = replace_binary(bootconf, 0x24, pack('L', nmodules))
modnamestart += 32
bootconf = replace_binary(bootconf, 0x30, pack('L', modnamestart))
modnameend += 32
bootconf = replace_binary(bootconf, 0x34, pack('L', modnameend))
i = 0
while i < nmodes:
num = unpack('H', bootconf[modestart+i*32:modestart+i*32+2])[0]
num += 1
bootconf = replace_binary(bootconf, modestart + i * 32, pack('H', num))
i += 1
return bootconf
def write_file(output_fn, data):
fn = open(output_fn, "wb")
fn.write(data)
fn.close()
def main():
global verbose
try:
optlist, args = gnu_getopt(sys.argv, "a:o:vh")
except GetoptError as err:
print(err)
print_usage()
sys.exit(1)
# default configure
verbose = False
dst_filename = "-"
add_module = ""
for o, a in optlist:
if o == "-v":
verbose = True
elif o == "-h":
print_usage()
sys.exit()
elif o == "-o":
dst_filename = a
elif o == "-a":
add_module = a
else:
assert False, "unhandled option"
if verbose:
print (optlist, args)
if len(args) < 2:
print ("Missing input pspbtcnf.bin")
sys.exit(1)
src_filename = args[1]
if verbose:
print ("src_filename: " + src_filename)
print ("dst_filename: " + dst_filename)
# check add_module
if add_module != "":
t = (re.split(":", add_module, re.I))
if len(t) != 3:
print ("Bad add_module input")
sys.exit(1)
add_module, before_module, add_module_flag = (re.split(":", add_module, re.I))
if verbose:
print ("add_module: " + add_module)
print ("before_module: " + before_module)
print ("add_module_flag: " + add_module_flag)
if add_module != "":
result = add_prx_to_bootconf(src_filename, before_module, add_module, int(add_module_flag, 16))
if dst_filename == "-":
# print("Bootconf result:")
# print(result)
pass
else:
write_file(dst_filename, result)
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_1374 | 107 | 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_1374:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 5], "level": 0, "parent": null, "vector": [8, 0, 0.022, 0.0165, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\npspbtcnf_editor: An script that add modules from pspbtcnf\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Import_L7_C0", "label": "sys import sys, os, re", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0055, 0, 0.66, 0.0769, 509, 0, 3, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys", "os", "re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys, os, re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:ImportFrom_L8_C0", "label": "from getopt import *", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.044, 0.0055, 0, 0.66, 0.1538, 588, 0, 1, 0, 0, 588, 0, 0], "semantic": {"name": "getopt", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from getopt import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:ImportFrom_L9_C0", "label": "from struct import *", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0495, 0.0055, 0, 0.66, 0.2308, 399, 0, 1, 0, 0, 399, 0, 0], "semantic": {"name": "struct", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from struct import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L11_C0", "label": "BTCNF_MAGIC =", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.0604, 0.0055, 0, 0.66, 0.3077, 993, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "BTCNF_MAGIC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "BTCNF_MAGIC=0x0F803001"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L13_C0", "label": "verbose =", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.0714, 0.0055, 0, 0.66, 0.3846, 108, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "verbose", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "verbose = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L15_C0", "label": "print_usage", "type": "function", "loc": [15, 16], "level": 0, "parent": null, "vector": [2, 0, 0.0852, 0.011, 0, 0.66, 0.4615, 311, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "print_usage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_usage():\n\tprint (\"%s: pspbtcnf.bin [-o output.bin] [-a add_module_name:before_module_name:flag]\" %(os.path.split(sys.argv[0]))[-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L16_C1", "label": "print()", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L15_C0", "vector": [8, 1, 0.0879, 0.0055, 1, 0.67, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\tprint (\"%s: pspbtcnf.bin [-o output.bin] [-a add_module_name:before_module_name:flag]\" %(os.path.split(sys.argv[0]))[-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L18_C0", "label": "replace_binary", "type": "function", "loc": [18, 21], "level": 0, "parent": null, "vector": [2, 0, 0.1071, 0.022, 0, 0.66, 0.5385, 531, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "replace_binary", "arg_names": ["data", "offset", "newdata"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def replace_binary(data, offset, newdata):\n\tnewdata = data[0:offset] + newdata + data[offset+len(newdata):]\n\tassert(len(data) == len(newdata))\n\treturn newdata"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L19_C1", "label": "newdata =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L18_C0", "vector": [14, 1, 0.1044, 0.0055, 1, 0.95, 0.0, 547, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "newdata", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tnewdata = data[0:offset] + newdata + data[offset+len(newdata):]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Return_L21_C1", "label": "return", "type": "return", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L18_C0", "vector": [13, 1, 0.1154, 0.0055, 1, 0.95, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn newdata"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L23_C0", "label": "dump_binary", "type": "function", "loc": [23, 27], "level": 0, "parent": null, "vector": [2, 0, 0.1374, 0.0275, 0, 0.66, 0.6154, 336, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "dump_binary", "arg_names": ["data", "offset", "size"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dump_binary(data, offset, size):\n\tnewdata = data[offset:offset+size]\n\tassert(len(newdata) == size)\n\n\treturn newdata"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L24_C1", "label": "newdata =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L23_C0", "vector": [14, 1, 0.1319, 0.0055, 1, 0.88, 0.0, 547, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "newdata", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tnewdata = data[offset:offset+size]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Return_L27_C1", "label": "return", "type": "return", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L23_C0", "vector": [13, 1, 0.1484, 0.0055, 1, 0.88, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn newdata"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L29_C0", "label": "dump_binary_str", "type": "function", "loc": [29, 38], "level": 0, "parent": null, "vector": [2, 0, 0.1841, 0.0549, 0, 0.66, 0.6923, 780, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "dump_binary_str", "arg_names": ["data", "offset"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dump_binary_str(data, offset):\n\tch = data[offset]\n\ttmp = b''\n\n\twhile ch != 0:\n\t\ttmp += pack('b', ch)\n\t\toffset += 1\n\t\tch = data[offset]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L30_C1", "label": "ch =", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L29_C0", "vector": [14, 1, 0.1648, 0.0055, 1, 0.76, 0.0, 263, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tch = data[offset]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L31_C1", "label": "tmp =", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L29_C0", "vector": [14, 1, 0.1703, 0.0055, 1, 0.76, 0.3333, 517, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tmp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttmp = b''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L33_C1", "label": "while", "type": "while", "loc": [33, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L29_C0", "vector": [5, 1, 0.1896, 0.022, 1, 0.76, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\twhile ch != 0:\n\t\ttmp += pack('b', ch)\n\t\toffset += 1\n\t\tch = data[offset]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L36_C2", "label": "ch =", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L33_C1", "vector": [14, 2, 0.1978, 0.0055, 2, 0.53, 0.0, 263, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tch = data[offset]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Return_L38_C1", "label": "return", "type": "return", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L29_C0", "vector": [13, 1, 0.2088, 0.0055, 1, 0.76, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn tmp.decode()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "label": "add_prx_to_bootconf", "type": "function", "loc": [40, 107], "level": 0, "parent": null, "vector": [2, 0, 0.4038, 0.3736, 0, 0.66, 0.7692, 740, 0, 4, 1, 0, 0, 0, 35], "semantic": {"name": "add_prx_to_bootconf", "arg_names": ["srcfn", "before_modname", "modname", "modflag"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def add_prx_to_bootconf(srcfn, before_modname, modname, modflag):\n\t\"Return new bootconf data\"\n\n\tfn=open(srcfn, \"rb\")\n\tbootconf = fn.read()\n\tfn.close()\n\n\tif len(bootconf) < 64:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L41_C1", "label": "expression", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [8, 1, 0.2253, 0.0055, 1, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\"Return new bootconf data\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L43_C1", "label": "fn = open()", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [14, 1, 0.2363, 0.0055, 1, 0.26, 0.0435, 59, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fn", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "\tfn=open(srcfn, \"rb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L44_C1", "label": "bootconf = read()", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [14, 1, 0.2418, 0.0055, 1, 0.26, 0.087, 489, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "bootconf", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": "\tbootconf = fn.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L45_C1", "label": "close()", "type": "expression", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [8, 1, 0.2473, 0.0055, 1, 0.26, 0.1304, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\tfn.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L47_C1", "label": "if", "type": "if", "loc": [47, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [4, 1, 0.261, 0.011, 1, 0.26, 0.1739, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif len(bootconf) < 64:\n\t\traise Exception(\"Bad bootconf\") "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L50_C1", "label": "signature, devkit, modestart, nmodes, modulestart, nmodules, modnamestart, modnameend = unpack()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [14, 1, 0.2747, 0.0055, 1, 0.26, 0.2174, 518, 3, 2, 0, 0, 621, 10, 1], "semantic": {"name": "signature, devkit, modestart, nmodes, modulestart, nmodules, modnamestart, modnameend", "arg_names": [], "import_names": [], "rhs_call_name": "unpack", "annotation": ""}, "snippet": "\tsignature, devkit, modestart, nmodes, modulestart, nmodules, modnamestart, modnameend = unpack('LL8xLL8xLL8xLL8x', bootconf[:64])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L52_C1", "label": "if", "type": "if", "loc": [52, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [4, 1, 0.3049, 0.044, 1, 0.26, 0.2609, 0, 2, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif verbose:\n\t\tprint (\"Devkit: 0x%08X\"%(devkit))\n\t\tprint (\"modestart: 0x%08X\"%(modestart))\n\t\tprint (\"nmodes: %d\"%(nmodes))\n\t\tprint (\"modulestart: 0x%08X\"%(modulestart))\n\t\tprint (\"nmodules: 0x%08X\"%(nmodules))\n\t\tprint (\"modnamestart: 0x%08X\"%(modnamestart))\n\t\tprint (\"modnameend: 0x%08X\"%(modnameend))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L53_C2", "label": "print()", "type": "expression", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L52_C1", "vector": [8, 2, 0.2912, 0.0055, 2, 0.08, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint (\"Devkit: 0x%08X\"%(devkit))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L54_C2", "label": "print()", "type": "expression", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L52_C1", "vector": [8, 2, 0.2967, 0.0055, 2, 0.08, 0.1667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint (\"modestart: 0x%08X\"%(modestart))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L55_C2", "label": "print()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L52_C1", "vector": [8, 2, 0.3022, 0.0055, 2, 0.08, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint (\"nmodes: %d\"%(nmodes))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L56_C2", "label": "print()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L52_C1", "vector": [8, 2, 0.3077, 0.0055, 2, 0.08, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint (\"modulestart: 0x%08X\"%(modulestart))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L57_C2", "label": "print()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L52_C1", "vector": [8, 2, 0.3132, 0.0055, 2, 0.08, 0.6667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint (\"nmodules: 0x%08X\"%(nmodules))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L58_C2", "label": "print()", "type": "expression", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L52_C1", "vector": [8, 2, 0.3187, 0.0055, 2, 0.08, 0.8333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint (\"modnamestart: 0x%08X\"%(modnamestart))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L59_C2", "label": "print()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L52_C1", "vector": [8, 2, 0.3242, 0.0055, 2, 0.08, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint (\"modnameend: 0x%08X\"%(modnameend))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L61_C1", "label": "if", "type": "if", "loc": [61, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [4, 1, 0.3379, 0.011, 1, 0.26, 0.3043, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif signature != BTCNF_MAGIC or nmodules <= 0 or nmodes <= 0:\n\t\traise Exception(\"Bad bootconf\") "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L64_C1", "label": "bootconf =", "type": "assigned_variable", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [14, 1, 0.3516, 0.0055, 1, 0.26, 0.3478, 489, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "bootconf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tbootconf = bootconf + modname.encode() + b'\\0'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L67_C1", "label": "i =", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [14, 1, 0.3681, 0.0055, 1, 0.26, 0.3913, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ti=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L69_C1", "label": "while", "type": "while", "loc": [69, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [5, 1, 0.4066, 0.0604, 1, 0.26, 0.4348, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\twhile i < nmodules:\n\t\tmodule_path, module_flags = unpack('L4xL4x16x', bootconf[modulestart+i*32:modulestart+(i+1)*32])\n\t\tmodule_name = dump_binary_str(bootconf, modnamestart+module_path)\n\n\t\tif verbose:\n\t\t\tprint (\"[%02d]: Module path: %s flag: 0x%08X\"%(i, module_name, module_flags))\n\n\t\tif before_modname == module_name:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L70_C2", "label": "module_path, module_flags = unpack()", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L69_C1", "vector": [14, 2, 0.3846, 0.0055, 2, 0.5, 0.0, 250, 3, 2, 0, 0, 621, 10, 1], "semantic": {"name": "module_path, module_flags", "arg_names": [], "import_names": [], "rhs_call_name": "unpack", "annotation": ""}, "snippet": "\t\tmodule_path, module_flags = unpack('L4xL4x16x', bootconf[modulestart+i*32:modulestart+(i+1)*32])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L71_C2", "label": "module_name = dump_binary_str()", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L69_C1", "vector": [14, 2, 0.3901, 0.0055, 2, 0.5, 0.3333, 672, 3, 2, 0, 0, 780, 10, 1], "semantic": {"name": "module_name", "arg_names": [], "import_names": [], "rhs_call_name": "dump_binary_str", "annotation": ""}, "snippet": "\t\tmodule_name = dump_binary_str(bootconf, modnamestart+module_path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L73_C2", "label": "if", "type": "if", "loc": [73, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L69_C1", "vector": [4, 2, 0.4038, 0.011, 2, 0.5, 0.6667, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif verbose:\n\t\t\tprint (\"[%02d]: Module path: %s flag: 0x%08X\"%(i, module_name, module_flags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L74_C3", "label": "print()", "type": "expression", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L73_C2", "vector": [8, 3, 0.4066, 0.0055, 3, 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": "\t\t\tprint (\"[%02d]: Module path: %s flag: 0x%08X\"%(i, module_name, module_flags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L76_C2", "label": "if", "type": "if", "loc": [76, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L69_C1", "vector": [4, 2, 0.4203, 0.011, 2, 0.5, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif before_modname == module_name:\n\t\t\tbreak"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L81_C1", "label": "if", "type": "if", "loc": [81, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [4, 1, 0.4478, 0.011, 1, 0.26, 0.4783, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif i >= nmodules:\n\t\traise Exception(\"module %s not found\"%(before_modname))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L84_C1", "label": "module_path =", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [14, 1, 0.4615, 0.0055, 1, 0.26, 0.5217, 663, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "module_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tmodule_path = modnameend - len(modname) - 1 - modnamestart"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L85_C1", "label": "module_flag =", "type": "assigned_variable", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [14, 1, 0.467, 0.0055, 1, 0.26, 0.5652, 213, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "module_flag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tmodule_flag = 0x80010000 | (modflag & 0xFFFF) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L86_C1", "label": "newmod = dump_binary()", "type": "assigned_variable", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [14, 1, 0.4725, 0.0055, 1, 0.26, 0.6087, 292, 3, 3, 0, 0, 336, 10, 1], "semantic": {"name": "newmod", "arg_names": [], "import_names": [], "rhs_call_name": "dump_binary", "annotation": ""}, "snippet": "\tnewmod = dump_binary(bootconf, modulestart+i*32, 32)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L87_C1", "label": "newmod = replace_binary()", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [14, 1, 0.478, 0.0055, 1, 0.26, 0.6522, 292, 3, 3, 0, 0, 531, 10, 2], "semantic": {"name": "newmod", "arg_names": [], "import_names": [], "rhs_call_name": "replace_binary", "annotation": ""}, "snippet": "\tnewmod = replace_binary(newmod, 0, pack('L', module_path))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L88_C1", "label": "newmod = replace_binary()", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [14, 1, 0.4835, 0.0055, 1, 0.26, 0.6957, 292, 3, 3, 0, 0, 531, 10, 2], "semantic": {"name": "newmod", "arg_names": [], "import_names": [], "rhs_call_name": "replace_binary", "annotation": ""}, "snippet": "\tnewmod = replace_binary(newmod, 8, pack('L', module_flag))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L90_C1", "label": "bootconf =", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [14, 1, 0.4945, 0.0055, 1, 0.26, 0.7391, 489, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "bootconf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tbootconf = bootconf[0:modulestart+i*32] + newmod + bootconf[modulestart+i*32:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L93_C1", "label": "bootconf = replace_binary()", "type": "assigned_variable", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [14, 1, 0.511, 0.0055, 1, 0.26, 0.7826, 489, 3, 3, 0, 0, 531, 10, 2], "semantic": {"name": "bootconf", "arg_names": [], "import_names": [], "rhs_call_name": "replace_binary", "annotation": ""}, "snippet": "\tbootconf = replace_binary(bootconf, 0x24, pack('L', nmodules))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L95_C1", "label": "bootconf = replace_binary()", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [14, 1, 0.522, 0.0055, 1, 0.26, 0.8261, 489, 3, 3, 0, 0, 531, 10, 2], "semantic": {"name": "bootconf", "arg_names": [], "import_names": [], "rhs_call_name": "replace_binary", "annotation": ""}, "snippet": "\tbootconf = replace_binary(bootconf, 0x30, pack('L', modnamestart))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L97_C1", "label": "bootconf = replace_binary()", "type": "assigned_variable", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [14, 1, 0.533, 0.0055, 1, 0.26, 0.8696, 489, 3, 3, 0, 0, 531, 10, 2], "semantic": {"name": "bootconf", "arg_names": [], "import_names": [], "rhs_call_name": "replace_binary", "annotation": ""}, "snippet": "\tbootconf = replace_binary(bootconf, 0x34, pack('L', modnameend))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L99_C1", "label": "i =", "type": "assigned_variable", "loc": [99, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [14, 1, 0.544, 0.0055, 1, 0.26, 0.913, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ti = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L101_C1", "label": "while", "type": "while", "loc": [101, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [5, 1, 0.5659, 0.0275, 1, 0.26, 0.9565, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\twhile i < nmodes:\n\t\tnum = unpack('H', bootconf[modestart+i*32:modestart+i*32+2])[0]\n\t\tnum += 1\n\t\tbootconf = replace_binary(bootconf, modestart + i * 32, pack('H', num))\n\t\ti += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L102_C2", "label": "num =", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L101_C1", "vector": [14, 2, 0.5604, 0.0055, 2, 0.3, 0.0, 328, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tnum = unpack('H', bootconf[modestart+i*32:modestart+i*32+2])[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L104_C2", "label": "bootconf = replace_binary()", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L101_C1", "vector": [14, 2, 0.5714, 0.0055, 2, 0.3, 1.0, 489, 3, 3, 0, 0, 531, 10, 2], "semantic": {"name": "bootconf", "arg_names": [], "import_names": [], "rhs_call_name": "replace_binary", "annotation": ""}, "snippet": "\t\tbootconf = replace_binary(bootconf, modestart + i * 32, pack('H', num))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Return_L107_C1", "label": "return", "type": "return", "loc": [107, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "vector": [13, 1, 0.5879, 0.0055, 1, 0.26, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn bootconf "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L109_C0", "label": "write_file", "type": "function", "loc": [109, 112], "level": 0, "parent": null, "vector": [2, 0, 0.6071, 0.022, 0, 0.66, 0.8462, 725, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "write_file", "arg_names": ["output_fn", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def write_file(output_fn, data):\n\tfn = open(output_fn, \"wb\")\n\tfn.write(data)\n\tfn.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L110_C1", "label": "fn = open()", "type": "assigned_variable", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L109_C0", "vector": [14, 1, 0.6044, 0.0055, 1, 0.98, 0.0, 59, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fn", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "\tfn = open(output_fn, \"wb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L111_C1", "label": "write()", "type": "expression", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L109_C0", "vector": [8, 1, 0.6099, 0.0055, 1, 0.98, 0.5, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "\tfn.write(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L112_C1", "label": "close()", "type": "expression", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L109_C0", "vector": [8, 1, 0.6154, 0.0055, 1, 0.98, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\tfn.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "label": "main", "type": "function", "loc": [114, 179], "level": 0, "parent": null, "vector": [2, 0, 0.8049, 0.3626, 0, 0.66, 0.9231, 624, 0, 0, 0, 0, 0, 0, 23], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n\tglobal verbose\n\n\ttry:\n\t\toptlist, args = gnu_getopt(sys.argv, \"a:o:vh\")\n\texcept GetoptError as err:\n\t\tprint(err)\n\t\tprint_usage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Try_L117_C1", "label": "try", "type": "try", "loc": [117, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "vector": [7, 1, 0.6566, 0.033, 1, 0.45, 0.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttry:\n\t\toptlist, args = gnu_getopt(sys.argv, \"a:o:vh\")\n\texcept GetoptError as err:\n\t\tprint(err)\n\t\tprint_usage()\n\t\tsys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L118_C2", "label": "optlist, args = gnu_getopt()", "type": "assigned_variable", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:Try_L117_C1", "vector": [14, 2, 0.6484, 0.0055, 2, 0.2, 0.0, 390, 3, 2, 0, 0, 712, 10, 1], "semantic": {"name": "optlist, args", "arg_names": [], "import_names": [], "rhs_call_name": "gnu_getopt", "annotation": ""}, "snippet": "\t\toptlist, args = gnu_getopt(sys.argv, \"a:o:vh\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L120_C2", "label": "print()", "type": "expression", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:Try_L117_C1", "vector": [8, 2, 0.6593, 0.0055, 2, 0.2, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint(err)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L121_C2", "label": "print_usage()", "type": "expression", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:Try_L117_C1", "vector": [8, 2, 0.6648, 0.0055, 2, 0.2, 0.5, 311, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "print_usage", "arg_names": [], "import_names": [], "rhs_call_name": "print_usage", "annotation": ""}, "snippet": "\t\tprint_usage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L122_C2", "label": "exit()", "type": "expression", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:Try_L117_C1", "vector": [8, 2, 0.6703, 0.0055, 2, 0.2, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\tsys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L125_C1", "label": "verbose =", "type": "assigned_variable", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "vector": [14, 1, 0.6868, 0.0055, 1, 0.45, 0.0909, 108, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "verbose", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tverbose = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L126_C1", "label": "dst_filename =", "type": "assigned_variable", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "vector": [14, 1, 0.6923, 0.0055, 1, 0.45, 0.1818, 403, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "dst_filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdst_filename = \"-\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L127_C1", "label": "add_module =", "type": "assigned_variable", "loc": [127, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "vector": [14, 1, 0.6978, 0.0055, 1, 0.45, 0.2727, 570, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "add_module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tadd_module = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:For_L129_C1", "label": "for o, a", "type": "for", "loc": [129, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "vector": [6, 1, 0.739, 0.0659, 1, 0.45, 0.3636, 736, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "o, a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor o, a in optlist:\n\t\tif o == \"-v\":\n\t\t\tverbose = True\n\t\telif o == \"-h\":\n\t\t\tprint_usage()\n\t\t\tsys.exit()\n\t\telif o == \"-o\":\n\t\t\tdst_filename = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L130_C2", "label": "if", "type": "if", "loc": [130, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:For_L129_C1", "vector": [4, 2, 0.7418, 0.0604, 2, 0.87, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif o == \"-v\":\n\t\t\tverbose = True\n\t\telif o == \"-h\":\n\t\t\tprint_usage()\n\t\t\tsys.exit()\n\t\telif o == \"-o\":\n\t\t\tdst_filename = a\n\t\telif o == \"-a\":"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L131_C3", "label": "verbose =", "type": "assigned_variable", "loc": [131, 131], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L130_C2", "vector": [14, 3, 0.7198, 0.0055, 3, 0.87, 0.0, 108, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "verbose", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tverbose = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L132_C2", "label": "if", "type": "if", "loc": [132, 140], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L130_C2", "vector": [4, 3, 0.7473, 0.0495, 3, 0.87, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif o == \"-h\":\n\t\t\tprint_usage()\n\t\t\tsys.exit()\n\t\telif o == \"-o\":\n\t\t\tdst_filename = a\n\t\telif o == \"-a\":\n\t\t\tadd_module = a\n\t\telse:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L133_C3", "label": "print_usage()", "type": "expression", "loc": [133, 133], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L132_C2", "vector": [8, 4, 0.7308, 0.0055, 4, 0.12, 0.0, 311, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "print_usage", "arg_names": [], "import_names": [], "rhs_call_name": "print_usage", "annotation": ""}, "snippet": "\t\t\tprint_usage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L134_C3", "label": "exit()", "type": "expression", "loc": [134, 134], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L132_C2", "vector": [8, 4, 0.7363, 0.0055, 4, 0.12, 0.5, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\t\tsys.exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L135_C2", "label": "if", "type": "if", "loc": [135, 140], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L132_C2", "vector": [4, 4, 0.7555, 0.033, 4, 0.12, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif o == \"-o\":\n\t\t\tdst_filename = a\n\t\telif o == \"-a\":\n\t\t\tadd_module = a\n\t\telse:\n\t\t\tassert False, \"unhandled option\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L136_C3", "label": "dst_filename =", "type": "assigned_variable", "loc": [136, 136], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L135_C2", "vector": [14, 5, 0.7473, 0.0055, 5, 0.55, 0.0, 403, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dst_filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tdst_filename = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L137_C2", "label": "if", "type": "if", "loc": [137, 140], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L135_C2", "vector": [4, 5, 0.761, 0.022, 5, 0.55, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif o == \"-a\":\n\t\t\tadd_module = a\n\t\telse:\n\t\t\tassert False, \"unhandled option\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L138_C3", "label": "add_module =", "type": "assigned_variable", "loc": [138, 138], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L137_C2", "vector": [14, 6, 0.7582, 0.0055, 6, 0.56, 0.0, 570, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "add_module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tadd_module = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L142_C1", "label": "if", "type": "if", "loc": [142, 143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "vector": [4, 1, 0.783, 0.011, 1, 0.45, 0.4545, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif verbose:\n\t\tprint (optlist, args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L143_C2", "label": "print()", "type": "expression", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L142_C1", "vector": [8, 2, 0.7857, 0.0055, 2, 0.06, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint (optlist, args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L145_C1", "label": "if", "type": "if", "loc": [145, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "vector": [4, 1, 0.8022, 0.0165, 1, 0.45, 0.5455, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif len(args) < 2:\n\t\tprint (\"Missing input pspbtcnf.bin\")\n\t\tsys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L146_C2", "label": "print()", "type": "expression", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L145_C1", "vector": [8, 2, 0.8022, 0.0055, 2, 0.74, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint (\"Missing input pspbtcnf.bin\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L147_C2", "label": "exit()", "type": "expression", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L145_C1", "vector": [8, 2, 0.8077, 0.0055, 2, 0.74, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\tsys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L149_C1", "label": "src_filename =", "type": "assigned_variable", "loc": [149, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "vector": [14, 1, 0.8187, 0.0055, 1, 0.45, 0.6364, 607, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "src_filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tsrc_filename = args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L151_C1", "label": "if", "type": "if", "loc": [151, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "vector": [4, 1, 0.8352, 0.0165, 1, 0.45, 0.7273, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif verbose:\n\t\tprint (\"src_filename: \" + src_filename)\n\t\tprint (\"dst_filename: \" + dst_filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L152_C2", "label": "print()", "type": "expression", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L151_C1", "vector": [8, 2, 0.8352, 0.0055, 2, 0.99, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint (\"src_filename: \" + src_filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L153_C2", "label": "print()", "type": "expression", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L151_C1", "vector": [8, 2, 0.8407, 0.0055, 2, 0.99, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint (\"dst_filename: \" + dst_filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L157_C1", "label": "if", "type": "if", "loc": [157, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "vector": [4, 1, 0.8956, 0.0714, 1, 0.45, 0.8182, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif add_module != \"\":\n\t\tt = (re.split(\":\", add_module, re.I))\n\n\t\tif len(t) != 3:\n\t\t\tprint (\"Bad add_module input\")\n\t\t\tsys.exit(1)\n\n\t\tadd_module, before_module, add_module_flag = (re.split(\":\", add_module, re.I))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L158_C2", "label": "t = split()", "type": "assigned_variable", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L157_C1", "vector": [14, 2, 0.8681, 0.0055, 2, 0.65, 0.0, 15, 3, 3, 0, 0, 908, 10, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": "\t\tt = (re.split(\":\", add_module, re.I))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L160_C2", "label": "if", "type": "if", "loc": [160, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L157_C1", "vector": [4, 2, 0.8846, 0.0165, 2, 0.65, 0.3333, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif len(t) != 3:\n\t\t\tprint (\"Bad add_module input\")\n\t\t\tsys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L161_C3", "label": "print()", "type": "expression", "loc": [161, 161], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L160_C2", "vector": [8, 3, 0.8846, 0.0055, 3, 0.46, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\tprint (\"Bad add_module input\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L162_C3", "label": "exit()", "type": "expression", "loc": [162, 162], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L160_C2", "vector": [8, 3, 0.8901, 0.0055, 3, 0.46, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\t\tsys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L164_C2", "label": "add_module, before_module, add_module_flag = split()", "type": "assigned_variable", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L157_C1", "vector": [14, 2, 0.9011, 0.0055, 2, 0.65, 0.6667, 518, 3, 3, 0, 0, 908, 10, 1], "semantic": {"name": "add_module, before_module, add_module_flag", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": "\t\tadd_module, before_module, add_module_flag = (re.split(\":\", add_module, re.I))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L166_C2", "label": "if", "type": "if", "loc": [166, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L157_C1", "vector": [4, 2, 0.9203, 0.022, 2, 0.65, 1.0, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif verbose:\n\t\t\tprint (\"add_module: \" + add_module)\n\t\t\tprint (\"before_module: \" + before_module)\n\t\t\tprint (\"add_module_flag: \" + add_module_flag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L167_C3", "label": "print()", "type": "expression", "loc": [167, 167], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L166_C2", "vector": [8, 3, 0.9176, 0.0055, 3, 0.52, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\tprint (\"add_module: \" + add_module)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L168_C3", "label": "print()", "type": "expression", "loc": [168, 168], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L166_C2", "vector": [8, 3, 0.9231, 0.0055, 3, 0.52, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\tprint (\"before_module: \" + before_module)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L169_C3", "label": "print()", "type": "expression", "loc": [169, 169], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L166_C2", "vector": [8, 3, 0.9286, 0.0055, 3, 0.52, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\tprint (\"add_module_flag: \" + add_module_flag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L171_C1", "label": "if", "type": "if", "loc": [171, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "vector": [4, 1, 0.9423, 0.011, 1, 0.45, 0.9091, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif add_module != \"\":\n\t\tresult = add_prx_to_bootconf(src_filename, before_module, add_module, int(add_module_flag, 16))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L172_C2", "label": "result = add_prx_to_bootconf()", "type": "assigned_variable", "loc": [172, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L171_C1", "vector": [14, 2, 0.9451, 0.0055, 2, 0.23, 0.0, 51, 3, 4, 0, 0, 740, 10, 2], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "add_prx_to_bootconf", "annotation": ""}, "snippet": "\t\tresult = add_prx_to_bootconf(src_filename, before_module, add_module, int(add_module_flag, 16))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L174_C1", "label": "if", "type": "if", "loc": [174, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "vector": [4, 1, 0.9698, 0.033, 1, 0.45, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif dst_filename == \"-\":\n#\t\tprint(\"Bootconf result:\")\n#\t\tprint(result)\n\t\tpass\n\telse:\n\t\twrite_file(dst_filename, result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L179_C2", "label": "write_file()", "type": "expression", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L174_C1", "vector": [8, 2, 0.9835, 0.0055, 2, 0.35, 0.0, 725, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "write_file", "arg_names": [], "import_names": [], "rhs_call_name": "write_file", "annotation": ""}, "snippet": "\t\twrite_file(dst_filename, result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L181_C0", "label": "if", "type": "if", "loc": [181, 182], "level": 0, "parent": null, "vector": [4, 0, 0.9973, 0.011, 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\tmain()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L182_C1", "label": "main()", "type": "expression", "loc": [182, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L181_C0", "vector": [8, 1, 1.0, 0.0055, 1, 0.92, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": "\tmain()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L16_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L19_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Return_L21_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L24_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Return_L27_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L30_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L31_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L33_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L33_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Return_L38_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L41_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L43_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L44_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L45_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L47_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L50_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L52_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L52_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L52_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L52_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L52_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L52_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L52_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L52_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L61_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L64_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L67_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L69_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L69_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L69_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L69_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L73_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L74_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L69_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L81_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L84_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L85_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L86_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L87_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L88_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L90_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L93_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L95_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L97_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L99_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L101_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L101_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L102_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:While_L101_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L104_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Return_L107_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L109_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L110_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L109_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L111_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L109_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L112_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Try_L117_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:Try_L117_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L118_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:Try_L117_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L120_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:Try_L117_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L121_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:Try_L117_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L122_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L125_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L126_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L127_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:For_L129_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:For_L129_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L130_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L130_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L131_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L130_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L132_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L133_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L134_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L135_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L135_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L136_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L135_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L137_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L137_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L138_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L142_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L142_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L143_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L145_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L145_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L146_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L145_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L147_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L149_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L151_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L151_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L152_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L151_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L153_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L157_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L157_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L158_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L157_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L160_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L160_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L161_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L160_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L162_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L157_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L164_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L157_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L166_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L166_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L167_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L166_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L168_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L166_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L169_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L171_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L171_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Assign_L172_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L174_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L174_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L179_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1374:If_L181_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1374:Expr_L182_C1"}] |
#!/usr/bin/python
class FakeTime:
def time(self):
return 1225856967.109
import sys, os, struct, gzip, hashlib, StringIO
gzip.time = FakeTime()
def binary_replace(data, newdata, offset):
return data[0:offset] + newdata + data[offset+len(newdata):]
def prx_compress(output, hdr, input, mod_name="", mod_attr=0xFFFFFFFF):
a=open(hdr, "rb")
fileheader = a.read();
a.close()
a=open(input, "rb")
elf = a.read(4);
a.close()
if (elf != '\x7fELF'.encode()):
print ("not a ELF/PRX file!")
return -1
uncompsize = os.stat(input).st_size
f_in=open(input, 'rb')
temp=StringIO.StringIO()
f=gzip.GzipFile(fileobj=temp, mode='wb')
f.writelines(f_in)
f.close()
f_in.close()
prx=temp.getvalue()
temp.close()
digest=hashlib.md5(prx).digest()
filesize = len(fileheader) + len(prx)
if mod_name != "":
if len(mod_name) < 28:
mod_name += "\x00" * (28-len(mod_name))
else:
mod_name = mod_name[0:28]
fileheader = binary_replace(fileheader, mod_name.encode(), 0xA)
if mod_attr != 0xFFFFFFFF:
fileheader = binary_replace(fileheader, struct.pack('H', mod_attr), 0x4)
fileheader = binary_replace(fileheader, struct.pack('L', uncompsize), 0x28)
fileheader = binary_replace(fileheader, struct.pack('L', filesize), 0x2c)
fileheader = binary_replace(fileheader, struct.pack('L', len(prx)), 0xb0)
fileheader = binary_replace(fileheader, digest, 0x140)
a=open(output, "wb")
assert(len(fileheader) == 0x150)
a.write(fileheader)
a.write(prx)
a.close()
try:
os.remove("tmp.gz")
except OSError:
pass
return 0
def main():
if len(sys.argv) < 4:
print ("Usage: %s outfile prxhdr infile [modname] [modattr]\n"%(sys.argv[0]))
exit(-1)
if len(sys.argv) < 5:
prx_compress(sys.argv[1], sys.argv[2], sys.argv[3])
elif len(sys.argv) < 6:
prx_compress(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
else:
prx_compress(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], int(sys.argv[5], 16))
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_1375 | 56 | 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_1375:ClassDef_L3_C0", "label": "FakeTime", "type": "class", "loc": [3, 5], "level": 0, "parent": null, "vector": [3, 0, 0.0488, 0.0366, 0, 0.66, 0.0, 425, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "FakeTime", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FakeTime:\n def time(self):\n return 1225856967.109"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L4_C4", "label": "time", "type": "function", "loc": [4, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:ClassDef_L3_C0", "vector": [2, 1, 0.0549, 0.0244, 1, 0.6, 0.0, 654, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "time", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def time(self):\n return 1225856967.109"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Return_L5_C8", "label": "return", "type": "return", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L4_C4", "vector": [13, 2, 0.061, 0.0122, 2, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 1225856967.109"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Import_L7_C0", "label": "sys import sys, os, struct\u2026", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0854, 0.0122, 0, 0.66, 0.1667, 509, 0, 6, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys", "os", "struct", "gzip", "hashlib", "StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys, os, struct, gzip, hashlib, StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L9_C0", "label": "gzip.time = FakeTime()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.1098, 0.0122, 0, 0.66, 0.3333, 7, 3, 0, 0, 0, 425, 10, 1], "semantic": {"name": "gzip.time", "arg_names": [], "import_names": [], "rhs_call_name": "FakeTime", "annotation": ""}, "snippet": "gzip.time = FakeTime()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L11_C0", "label": "binary_replace", "type": "function", "loc": [11, 12], "level": 0, "parent": null, "vector": [2, 0, 0.1402, 0.0244, 0, 0.66, 0.5, 457, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "binary_replace", "arg_names": ["data", "newdata", "offset"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def binary_replace(data, newdata, offset):\n\treturn data[0:offset] + newdata + data[offset+len(newdata):]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Return_L12_C1", "label": "return", "type": "return", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L11_C0", "vector": [13, 1, 0.1463, 0.0122, 1, 0.2, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn data[0:offset] + newdata + data[offset+len(newdata):]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "label": "prx_compress", "type": "function", "loc": [14, 67], "level": 0, "parent": null, "vector": [2, 0, 0.4939, 0.6585, 0, 0.66, 0.6667, 857, 0, 5, 1, 0, 0, 0, 41], "semantic": {"name": "prx_compress", "arg_names": ["output", "hdr", "input", "mod_name", "mod_attr"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def prx_compress(output, hdr, input, mod_name=\"\", mod_attr=0xFFFFFFFF):\n\ta=open(hdr, \"rb\")\n\tfileheader = a.read();\n\ta.close()\n\n\ta=open(input, \"rb\")\n\telf = a.read(4);\n\ta.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L15_C1", "label": "a = open()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [14, 1, 0.1829, 0.0122, 1, 0.85, 0.0, 475, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "\ta=open(hdr, \"rb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L16_C1", "label": "fileheader = read()", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [14, 1, 0.1951, 0.0122, 1, 0.85, 0.0345, 252, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "fileheader", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": "\tfileheader = a.read();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L17_C1", "label": "close()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [8, 1, 0.2073, 0.0122, 1, 0.85, 0.069, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\ta.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L19_C1", "label": "a = open()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [14, 1, 0.2317, 0.0122, 1, 0.85, 0.1034, 475, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "\ta=open(input, \"rb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L20_C1", "label": "elf = read()", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [14, 1, 0.2439, 0.0122, 1, 0.85, 0.1379, 674, 3, 1, 0, 0, 453, 10, 1], "semantic": {"name": "elf", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": "\telf = a.read(4);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L21_C1", "label": "close()", "type": "expression", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [8, 1, 0.2561, 0.0122, 1, 0.85, 0.1724, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\ta.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L23_C1", "label": "if", "type": "if", "loc": [23, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [4, 1, 0.2927, 0.0366, 1, 0.85, 0.2069, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif (elf != '\\x7fELF'.encode()):\n\t\tprint (\"not a ELF/PRX file!\")\n\t\treturn -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L24_C2", "label": "print()", "type": "expression", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L23_C1", "vector": [8, 2, 0.2927, 0.0122, 2, 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": "\t\tprint (\"not a ELF/PRX file!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Return_L25_C2", "label": "return", "type": "return", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L23_C1", "vector": [13, 2, 0.3049, 0.0122, 2, 0.85, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L27_C1", "label": "uncompsize =", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [14, 1, 0.3293, 0.0122, 1, 0.85, 0.2414, 99, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "uncompsize", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tuncompsize = os.stat(input).st_size"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L29_C1", "label": "f_in = open()", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [14, 1, 0.3537, 0.0122, 1, 0.85, 0.2759, 7, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f_in", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "\tf_in=open(input, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L30_C1", "label": "temp = StringIO()", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [14, 1, 0.3659, 0.0122, 1, 0.85, 0.3103, 915, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "temp", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": "\ttemp=StringIO.StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L31_C1", "label": "f = GzipFile()", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [14, 1, 0.378, 0.0122, 1, 0.85, 0.3448, 899, 3, 2, 0, 0, 940, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "GzipFile", "annotation": ""}, "snippet": "\tf=gzip.GzipFile(fileobj=temp, mode='wb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L32_C1", "label": "writelines()", "type": "expression", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [8, 1, 0.3902, 0.0122, 1, 0.85, 0.3793, 290, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "writelines", "arg_names": [], "import_names": [], "rhs_call_name": "writelines", "annotation": ""}, "snippet": "\tf.writelines(f_in)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L33_C1", "label": "close()", "type": "expression", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [8, 1, 0.4024, 0.0122, 1, 0.85, 0.4138, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\tf.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L34_C1", "label": "close()", "type": "expression", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [8, 1, 0.4146, 0.0122, 1, 0.85, 0.4483, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\tf_in.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L35_C1", "label": "prx = getvalue()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [14, 1, 0.4268, 0.0122, 1, 0.85, 0.4828, 27, 3, 0, 0, 0, 626, 10, 1], "semantic": {"name": "prx", "arg_names": [], "import_names": [], "rhs_call_name": "getvalue", "annotation": ""}, "snippet": "\tprx=temp.getvalue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L36_C1", "label": "close()", "type": "expression", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [8, 1, 0.439, 0.0122, 1, 0.85, 0.5172, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\ttemp.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L38_C1", "label": "digest = digest()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [14, 1, 0.4634, 0.0122, 1, 0.85, 0.5517, 142, 3, 0, 0, 0, 142, 10, 2], "semantic": {"name": "digest", "arg_names": [], "import_names": [], "rhs_call_name": "digest", "annotation": ""}, "snippet": "\tdigest=hashlib.md5(prx).digest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L39_C1", "label": "filesize =", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [14, 1, 0.4756, 0.0122, 1, 0.85, 0.5862, 458, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "filesize", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfilesize = len(fileheader) + len(prx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L41_C1", "label": "if", "type": "if", "loc": [41, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [4, 1, 0.5305, 0.0732, 1, 0.85, 0.6207, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif mod_name != \"\":\n\t\tif len(mod_name) < 28:\n\t\t\tmod_name += \"\\x00\" * (28-len(mod_name))\n\t\telse:\n\t\t\tmod_name = mod_name[0:28]\n\t\tfileheader = binary_replace(fileheader, mod_name.encode(), 0xA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L42_C2", "label": "if", "type": "if", "loc": [42, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L41_C1", "vector": [4, 2, 0.5305, 0.0488, 2, 0.15, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif len(mod_name) < 28:\n\t\t\tmod_name += \"\\x00\" * (28-len(mod_name))\n\t\telse:\n\t\t\tmod_name = mod_name[0:28]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L45_C3", "label": "mod_name =", "type": "assigned_variable", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L42_C2", "vector": [14, 3, 0.5488, 0.0122, 3, 0.0, 0.0, 592, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "mod_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tmod_name = mod_name[0:28]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L46_C2", "label": "fileheader = binary_replace()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L41_C1", "vector": [14, 2, 0.561, 0.0122, 2, 0.15, 1.0, 252, 3, 3, 0, 0, 457, 10, 2], "semantic": {"name": "fileheader", "arg_names": [], "import_names": [], "rhs_call_name": "binary_replace", "annotation": ""}, "snippet": "\t\tfileheader = binary_replace(fileheader, mod_name.encode(), 0xA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L48_C1", "label": "if", "type": "if", "loc": [48, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [4, 1, 0.5915, 0.0244, 1, 0.85, 0.6552, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif mod_attr != 0xFFFFFFFF:\n\t\tfileheader = binary_replace(fileheader, struct.pack('H', mod_attr), 0x4)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L49_C2", "label": "fileheader = binary_replace()", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L48_C1", "vector": [14, 2, 0.5976, 0.0122, 2, 0.73, 0.0, 252, 3, 3, 0, 0, 457, 10, 2], "semantic": {"name": "fileheader", "arg_names": [], "import_names": [], "rhs_call_name": "binary_replace", "annotation": ""}, "snippet": "\t\tfileheader = binary_replace(fileheader, struct.pack('H', mod_attr), 0x4)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L51_C1", "label": "fileheader = binary_replace()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [14, 1, 0.622, 0.0122, 1, 0.85, 0.6897, 252, 3, 3, 0, 0, 457, 10, 2], "semantic": {"name": "fileheader", "arg_names": [], "import_names": [], "rhs_call_name": "binary_replace", "annotation": ""}, "snippet": "\tfileheader = binary_replace(fileheader, struct.pack('L', uncompsize), 0x28)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L52_C1", "label": "fileheader = binary_replace()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [14, 1, 0.6341, 0.0122, 1, 0.85, 0.7241, 252, 3, 3, 0, 0, 457, 10, 2], "semantic": {"name": "fileheader", "arg_names": [], "import_names": [], "rhs_call_name": "binary_replace", "annotation": ""}, "snippet": "\tfileheader = binary_replace(fileheader, struct.pack('L', filesize), 0x2c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L53_C1", "label": "fileheader = binary_replace()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [14, 1, 0.6463, 0.0122, 1, 0.85, 0.7586, 252, 3, 3, 0, 0, 457, 10, 3], "semantic": {"name": "fileheader", "arg_names": [], "import_names": [], "rhs_call_name": "binary_replace", "annotation": ""}, "snippet": "\tfileheader = binary_replace(fileheader, struct.pack('L', len(prx)), 0xb0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L54_C1", "label": "fileheader = binary_replace()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [14, 1, 0.6585, 0.0122, 1, 0.85, 0.7931, 252, 3, 3, 0, 0, 457, 10, 1], "semantic": {"name": "fileheader", "arg_names": [], "import_names": [], "rhs_call_name": "binary_replace", "annotation": ""}, "snippet": "\tfileheader = binary_replace(fileheader, digest, 0x140)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L56_C1", "label": "a = open()", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [14, 1, 0.6829, 0.0122, 1, 0.85, 0.8276, 475, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "\ta=open(output, \"wb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L58_C1", "label": "write()", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [8, 1, 0.7073, 0.0122, 1, 0.85, 0.8621, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "\ta.write(fileheader)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L59_C1", "label": "write()", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [8, 1, 0.7195, 0.0122, 1, 0.85, 0.8966, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "\ta.write(prx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L60_C1", "label": "close()", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [8, 1, 0.7317, 0.0122, 1, 0.85, 0.931, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\ta.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Try_L62_C1", "label": "try", "type": "try", "loc": [62, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [7, 1, 0.7744, 0.0488, 1, 0.85, 0.9655, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttry:\n\t\tos.remove(\"tmp.gz\")\n\texcept OSError:\n\t\tpass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L63_C2", "label": "remove()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:Try_L62_C1", "vector": [8, 2, 0.7683, 0.0122, 2, 0.66, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": "\t\tos.remove(\"tmp.gz\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Return_L67_C1", "label": "return", "type": "return", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "vector": [13, 1, 0.8171, 0.0122, 1, 0.85, 1.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L69_C0", "label": "main", "type": "function", "loc": [69, 79], "level": 0, "parent": null, "vector": [2, 0, 0.9024, 0.1341, 0, 0.66, 0.8333, 624, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n\tif len(sys.argv) < 4:\n\t\tprint (\"Usage: %s outfile prxhdr infile [modname] [modattr]\\n\"%(sys.argv[0]))\n\t\texit(-1)\n\n\tif len(sys.argv) < 5:\n\t\tprx_compress(sys.argv[1], sys.argv[2], sys.argv[3])\n\telif len(sys.argv) < 6:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L70_C1", "label": "if", "type": "if", "loc": [70, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L69_C0", "vector": [4, 1, 0.8659, 0.0366, 1, 0.34, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif len(sys.argv) < 4:\n\t\tprint (\"Usage: %s outfile prxhdr infile [modname] [modattr]\\n\"%(sys.argv[0]))\n\t\texit(-1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L71_C2", "label": "print()", "type": "expression", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L70_C1", "vector": [8, 2, 0.8659, 0.0122, 2, 0.06, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint (\"Usage: %s outfile prxhdr infile [modname] [modattr]\\n\"%(sys.argv[0]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L72_C2", "label": "exit()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L70_C1", "vector": [8, 2, 0.878, 0.0122, 2, 0.06, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\texit(-1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L74_C1", "label": "if", "type": "if", "loc": [74, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L69_C0", "vector": [4, 1, 0.9329, 0.0732, 1, 0.34, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif len(sys.argv) < 5:\n\t\tprx_compress(sys.argv[1], sys.argv[2], sys.argv[3])\n\telif len(sys.argv) < 6:\n\t\tprx_compress(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])\n\telse:\n\t\tprx_compress(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], int(sys.argv[5], 16))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L75_C2", "label": "prx_compress()", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L74_C1", "vector": [8, 2, 0.9146, 0.0122, 2, 0.09, 0.0, 857, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "prx_compress", "arg_names": [], "import_names": [], "rhs_call_name": "prx_compress", "annotation": ""}, "snippet": "\t\tprx_compress(sys.argv[1], sys.argv[2], sys.argv[3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L76_C1", "label": "if", "type": "if", "loc": [76, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L74_C1", "vector": [4, 2, 0.9451, 0.0488, 2, 0.09, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\telif len(sys.argv) < 6:\n\t\tprx_compress(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])\n\telse:\n\t\tprx_compress(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], int(sys.argv[5], 16))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L77_C2", "label": "prx_compress()", "type": "expression", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L76_C1", "vector": [8, 3, 0.939, 0.0122, 3, 0.82, 0.0, 857, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "prx_compress", "arg_names": [], "import_names": [], "rhs_call_name": "prx_compress", "annotation": ""}, "snippet": "\t\tprx_compress(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L79_C2", "label": "prx_compress()", "type": "expression", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L76_C1", "vector": [8, 3, 0.9634, 0.0122, 3, 0.82, 1.0, 857, 3, 5, 0, 0, 0, 0, 2], "semantic": {"name": "prx_compress", "arg_names": [], "import_names": [], "rhs_call_name": "prx_compress", "annotation": ""}, "snippet": "\t\tprx_compress(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], int(sys.argv[5], 16))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L81_C0", "label": "if", "type": "if", "loc": [81, 82], "level": 0, "parent": null, "vector": [4, 0, 0.9939, 0.0244, 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\tmain()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L82_C1", "label": "main()", "type": "expression", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L81_C0", "vector": [8, 1, 1.0, 0.0122, 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": "\tmain()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1375:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Return_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Return_L12_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L15_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L16_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L17_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L19_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L20_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L21_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L23_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L23_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L23_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Return_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L27_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L29_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L30_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L31_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L32_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L33_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L34_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L35_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L36_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L38_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L39_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L41_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L41_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L42_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L45_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L41_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L48_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L48_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L51_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L52_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L53_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L54_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Assign_L56_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L58_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L59_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L60_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Try_L62_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:Try_L62_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Return_L67_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L70_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L70_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L70_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L74_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L74_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L74_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L76_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L76_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L76_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L79_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1375:If_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1375:Expr_L82_C1"}] |
#!/usr/bin/env python
import time
t = time.time()
u = time.gmtime(t)
s = time.strftime('%a, %e %b %Y %T GMT', u)
print 'Content-Type: text/javascript'
print 'Cache-Control: no-cache'
print 'Date: ' + s
print 'Expires: ' + s
print ''
print 'var timeskew = new Date().getTime() - ' + str(t*1000) + ';'
| ajibawa-2023/Python-Code-Large/train/row_1376 | 10 | 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_1376:Import_L2_C0", "label": "time import time", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0909, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1376:Assign_L3_C0", "label": "t = time()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.2727, 0.0909, 0, 0.66, 0.1111, 15, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": "t = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1376:Assign_L4_C0", "label": "u = gmtime()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.3636, 0.0909, 0, 0.66, 0.2222, 609, 3, 1, 0, 0, 68, 10, 1], "semantic": {"name": "u", "arg_names": [], "import_names": [], "rhs_call_name": "gmtime", "annotation": ""}, "snippet": "u = time.gmtime(t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1376:Assign_L5_C0", "label": "s = strftime()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.4545, 0.0909, 0, 0.66, 0.3333, 553, 3, 2, 0, 0, 668, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "strftime", "annotation": ""}, "snippet": "s = time.strftime('%a, %e %b %Y %T GMT', u)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1376:Expr_L6_C0", "label": "print()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.5455, 0.0909, 0, 0.66, 0.4444, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('Content-Type: text/javascript')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1376:Expr_L7_C0", "label": "print()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.6364, 0.0909, 0, 0.66, 0.5556, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('Cache-Control: no-cache')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1376:Expr_L8_C0", "label": "print()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.7273, 0.0909, 0, 0.66, 0.6667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('Date: ' + s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1376:Expr_L9_C0", "label": "print()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.8182, 0.0909, 0, 0.66, 0.7778, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('Expires: ' + s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1376:Expr_L10_C0", "label": "print()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.9091, 0.0909, 0, 0.66, 0.8889, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1376:Expr_L11_C0", "label": "print()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0909, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('var timeskew = new Date().getTime() - ' + str(t*1000) + ';')"}] | [] |
#!/bin/env python
import xml.dom.minidom as dom
import sys
import struct
WEAP_NUM = 780
struct_fmt = "<H BBHBBBB 8B8B8b8b8b8b8H bbBBBB"
def pack_weapon(dict):
l = []
l.append(dict['drain'])
l.append(dict['shotRepeat'])
l.append(dict['multi'])
l.append(dict['weapAni'])
l.append(dict['max'])
l.append(dict['tx'])
l.append(dict['ty'])
l.append(dict['aim'])
tmp = dict['patterns']
for j in xrange(8):
l.append(tmp[j]['attack'])
for j in xrange(8):
l.append(tmp[j]['del'])
for j in xrange(8):
l.append(tmp[j]['sx'])
for j in xrange(8):
l.append(tmp[j]['sy'])
for j in xrange(8):
l.append(tmp[j]['bx'])
for j in xrange(8):
l.append(tmp[j]['by'])
for j in xrange(8):
l.append(tmp[j]['sg'])
l.append(dict['acceleration'])
l.append(dict['accelerationx'])
l.append(dict['circleSize'])
l.append(dict['sound'])
l.append(dict['trail'])
l.append(dict['shipBlastFilter'])
return struct.pack(struct_fmt, *l)
def unpack_weapon(str):
tup = struct.unpack(struct_fmt, str)
dict = {}
dict['drain'] = tup[0]
dict['shotRepeat'] = tup[1]
dict['multi'] = tup[2]
dict['weapAni'] = tup[3]
dict['max'] = tup[4]
dict['tx'] = tup[5]
dict['ty'] = tup[6]
dict['aim'] = tup[7]
i = 8
tmp = [{} for j in xrange(8)]
for j in xrange(8):
tmp[j]['attack'] = tup[i]
i += 1
for j in xrange(8):
tmp[j]['del'] = tup[i]
i += 1
for j in xrange(8):
tmp[j]['sx'] = tup[i]
i += 1
for j in xrange(8):
tmp[j]['sy'] = tup[i]
i += 1
for j in xrange(8):
tmp[j]['bx'] = tup[i]
i += 1
for j in xrange(8):
tmp[j]['by'] = tup[i]
i += 1
for j in xrange(8):
tmp[j]['sg'] = tup[i]
i += 1
dict['patterns'] = tmp
dict['acceleration'] = tup[i]
dict['accelerationx'] = tup[i+1]
dict['circleSize'] = tup[i+2]
dict['sound'] = tup[i+3]
dict['trail'] = tup[i+4]
dict['shipBlastFilter'] = tup[i+5]
return dict
def DOMToDict(doc, weap_node):
dict = {}
for i in weap_node.childNodes:
if i.nodeType != i.ELEMENT_NODE:
continue
if i.hasAttribute("value"):
dict[i.tagName] = int(i.getAttribute("value"))
elif i.tagName == "patterns":
dict['patterns'] = [{} for el in xrange(8)]
index = 0
for j in i.childNodes:
if j.nodeType != i.ELEMENT_NODE:
continue
attrs = [j.attributes.item(i) for i in xrange(j.attributes.length)]
for i in attrs:
dict['patterns'][index][i.name] = int(i.nodeValue)
index += 1
return dict
def dictToDOM(doc, root, dict, index=None):
entry = doc.createElement("weapon")
if index != None:
entry.setAttribute("index", "%04X" % (index,))
keys = dict.keys()
keys.sort()
for i in keys:
node = doc.createElement(i)
if isinstance(dict[i], list):
for j in dict[i]:
keys = j.keys()
keys.sort()
n = doc.createElement("entry")
for i in keys:
n.setAttribute(i, str(j[i]))
node.appendChild(n)
else:
node.setAttribute("value", str(dict[i]))
entry.appendChild(node)
root.appendChild(entry)
def toXML(hdt, output):
doc = dom.getDOMImplementation().createDocument(None, "TyrianHDT", None)
try:
f = file(hdt, "rb")
except IOError:
print "%s couldn't be opened for reading." % (hdt,)
sys.exit(1)
try:
outf = file(output, "w")
except IOError:
print "%s couldn't be opened for writing." % (outf,)
sys.exit(1)
f.seek(struct.unpack("<i", f.read(4))[0])
f.read(7*2)
sys.stdout.write("Converting weapons")
index = 0
for i in xrange(WEAP_NUM+1):
tmp = f.read(struct.calcsize(struct_fmt))
shot = unpack_weapon(tmp)
dictToDOM(doc, doc.documentElement, shot, index)
index += 1
sys.stdout.write(".")
sys.stdout.flush()
sys.stdout.write("Done!\n")
sys.stdout.write("Writing XML...")
sys.stdout.flush()
doc.writexml(outf, addindent="\t", newl="\n")
sys.stdout.write("Done!\n")
def toHDT(input, hdt):
try:
f = file(input, "r")
except IOError:
print "%s couldn't be opened for reading." % (input,)
sys.exit(1)
try:
outf = file(hdt, "r+b")
except IOError:
print "%s couldn't be opened for writing." % (hdt,)
sys.exit(1)
outf.seek(struct.unpack("<i", outf.read(4))[0])
outf.read(7*2)
sys.stdout.write("Reading XML...")
sys.stdout.flush()
doc = dom.parse(f)
sys.stdout.write("Done!\n")
sys.stdout.write("Writing weapons")
for i in doc.documentElement.childNodes:
if i.nodeType != i.ELEMENT_NODE:
continue
shot = DOMToDict(doc, i)
str = pack_weapon(shot)
outf.write(str)
sys.stdout.write(".")
sys.stdout.flush()
sys.stdout.write("Done!\n")
def printHelp():
print "Usage: weapons.py toxml path/to/tyrian.hdt output.xml"
print " weapons.py tohdt input.xml path/to/tyrian.hdt"
sys.exit(1)
##############################
if __name__ == "__main__":
if len(sys.argv) != 4:
printHelp()
if sys.argv[1] == "toxml":
toXML(sys.argv[2], sys.argv[3])
elif sys.argv[1] == "tohdt":
toHDT(sys.argv[2], sys.argv[3])
else:
printHelp()
| ajibawa-2023/Python-Code-Large/train/row_1377 | 167 | 233 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Import_L3_C0", "label": "xml.dom.minidom import dom", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0129, 0.0043, 0, 0.66, 0.0, 770, 0, 1, 0, 0, 770, 0, 0], "semantic": {"name": "xml.dom.minidom", "arg_names": [], "import_names": ["dom"], "rhs_call_name": "", "annotation": ""}, "snippet": "import xml.dom.minidom as dom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Import_L4_C0", "label": "sys import sys", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0172, 0.0043, 0, 0.66, 0.0833, 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_1377:Import_L5_C0", "label": "struct import struct", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0215, 0.0043, 0, 0.66, 0.1667, 399, 0, 1, 0, 0, 399, 0, 0], "semantic": {"name": "struct", "arg_names": [], "import_names": ["struct"], "rhs_call_name": "", "annotation": ""}, "snippet": "import struct"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L7_C0", "label": "WEAP_NUM =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.03, 0.0043, 0, 0.66, 0.25, 514, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "WEAP_NUM", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WEAP_NUM = 780"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L9_C0", "label": "struct_fmt =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.0386, 0.0043, 0, 0.66, 0.3333, 902, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "struct_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "struct_fmt = \"<H BBHBBBB 8B8B8b8b8b8b8H bbBBBB\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "label": "pack_weapon", "type": "function", "loc": [11, 46], "level": 0, "parent": null, "vector": [2, 0, 0.1223, 0.1545, 0, 0.66, 0.4167, 979, 0, 1, 1, 0, 0, 0, 29], "semantic": {"name": "pack_weapon", "arg_names": ["dict"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def pack_weapon(dict):\n\tl = []\n\n\tl.append(dict['drain'])\n\tl.append(dict['shotRepeat'])\n\tl.append(dict['multi'])\n\tl.append(dict['weapAni'])\n\tl.append(dict['max'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L12_C1", "label": "l =", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [14, 1, 0.0515, 0.0043, 1, 0.98, 0.0, 810, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tl = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L14_C1", "label": "append()", "type": "expression", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [8, 1, 0.0601, 0.0043, 1, 0.98, 0.0435, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\tl.append(dict['drain'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L15_C1", "label": "append()", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [8, 1, 0.0644, 0.0043, 1, 0.98, 0.087, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\tl.append(dict['shotRepeat'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L16_C1", "label": "append()", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [8, 1, 0.0687, 0.0043, 1, 0.98, 0.1304, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\tl.append(dict['multi'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L17_C1", "label": "append()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [8, 1, 0.073, 0.0043, 1, 0.98, 0.1739, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\tl.append(dict['weapAni'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L18_C1", "label": "append()", "type": "expression", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [8, 1, 0.0773, 0.0043, 1, 0.98, 0.2174, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\tl.append(dict['max'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L19_C1", "label": "append()", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [8, 1, 0.0815, 0.0043, 1, 0.98, 0.2609, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\tl.append(dict['tx'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L20_C1", "label": "append()", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [8, 1, 0.0858, 0.0043, 1, 0.98, 0.3043, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\tl.append(dict['ty'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L21_C1", "label": "append()", "type": "expression", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [8, 1, 0.0901, 0.0043, 1, 0.98, 0.3478, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\tl.append(dict['aim'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L23_C1", "label": "tmp =", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [14, 1, 0.0987, 0.0043, 1, 0.98, 0.3913, 517, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tmp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttmp = dict['patterns']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L24_C1", "label": "for j", "type": "for", "loc": [24, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [6, 1, 0.1052, 0.0086, 1, 0.98, 0.4348, 100, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor j in xrange(8):\n\t\tl.append(tmp[j]['attack'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L25_C2", "label": "append()", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L24_C1", "vector": [8, 2, 0.1073, 0.0043, 2, 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": "\t\tl.append(tmp[j]['attack'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L26_C1", "label": "for j", "type": "for", "loc": [26, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [6, 1, 0.1137, 0.0086, 1, 0.98, 0.4783, 100, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor j in xrange(8):\n\t\tl.append(tmp[j]['del'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L27_C2", "label": "append()", "type": "expression", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L26_C1", "vector": [8, 2, 0.1159, 0.0043, 2, 0.55, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\t\tl.append(tmp[j]['del'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L28_C1", "label": "for j", "type": "for", "loc": [28, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [6, 1, 0.1223, 0.0086, 1, 0.98, 0.5217, 100, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor j in xrange(8):\n\t\tl.append(tmp[j]['sx'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L29_C2", "label": "append()", "type": "expression", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L28_C1", "vector": [8, 2, 0.1245, 0.0043, 2, 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": "\t\tl.append(tmp[j]['sx'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L30_C1", "label": "for j", "type": "for", "loc": [30, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [6, 1, 0.1309, 0.0086, 1, 0.98, 0.5652, 100, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor j in xrange(8):\n\t\tl.append(tmp[j]['sy'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L31_C2", "label": "append()", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L30_C1", "vector": [8, 2, 0.133, 0.0043, 2, 0.57, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\t\tl.append(tmp[j]['sy'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L32_C1", "label": "for j", "type": "for", "loc": [32, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [6, 1, 0.1395, 0.0086, 1, 0.98, 0.6087, 100, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor j in xrange(8):\n\t\tl.append(tmp[j]['bx'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L33_C2", "label": "append()", "type": "expression", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L32_C1", "vector": [8, 2, 0.1416, 0.0043, 2, 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": "\t\tl.append(tmp[j]['bx'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L34_C1", "label": "for j", "type": "for", "loc": [34, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [6, 1, 0.1481, 0.0086, 1, 0.98, 0.6522, 100, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor j in xrange(8):\n\t\tl.append(tmp[j]['by'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L35_C2", "label": "append()", "type": "expression", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L34_C1", "vector": [8, 2, 0.1502, 0.0043, 2, 0.22, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\t\tl.append(tmp[j]['by'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L36_C1", "label": "for j", "type": "for", "loc": [36, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [6, 1, 0.1567, 0.0086, 1, 0.98, 0.6957, 100, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor j in xrange(8):\n\t\tl.append(tmp[j]['sg'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L37_C2", "label": "append()", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L36_C1", "vector": [8, 2, 0.1588, 0.0043, 2, 0.51, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\t\tl.append(tmp[j]['sg'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L39_C1", "label": "append()", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [8, 1, 0.1674, 0.0043, 1, 0.98, 0.7391, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\tl.append(dict['acceleration'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L40_C1", "label": "append()", "type": "expression", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [8, 1, 0.1717, 0.0043, 1, 0.98, 0.7826, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\tl.append(dict['accelerationx'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L41_C1", "label": "append()", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [8, 1, 0.176, 0.0043, 1, 0.98, 0.8261, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\tl.append(dict['circleSize'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L42_C1", "label": "append()", "type": "expression", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [8, 1, 0.1803, 0.0043, 1, 0.98, 0.8696, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\tl.append(dict['sound'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L43_C1", "label": "append()", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [8, 1, 0.1845, 0.0043, 1, 0.98, 0.913, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\tl.append(dict['trail'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L44_C1", "label": "append()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [8, 1, 0.1888, 0.0043, 1, 0.98, 0.9565, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\tl.append(dict['shipBlastFilter'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Return_L46_C1", "label": "return", "type": "return", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "vector": [13, 1, 0.1974, 0.0043, 1, 0.98, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn struct.pack(struct_fmt, *l)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "label": "unpack_weapon", "type": "function", "loc": [48, 94], "level": 0, "parent": null, "vector": [2, 0, 0.3047, 0.2017, 0, 0.66, 0.5, 173, 0, 1, 1, 0, 0, 0, 9], "semantic": {"name": "unpack_weapon", "arg_names": ["str"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def unpack_weapon(str):\n\ttup = struct.unpack(struct_fmt, str)\n\tdict = {}\n\n\tdict['drain'] = tup[0]\n\tdict['shotRepeat'] = tup[1]\n\tdict['multi'] = tup[2]\n\tdict['weapAni'] = tup[3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L49_C1", "label": "tup = unpack()", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [14, 1, 0.2103, 0.0043, 1, 0.46, 0.0, 218, 3, 2, 0, 0, 621, 10, 1], "semantic": {"name": "tup", "arg_names": [], "import_names": [], "rhs_call_name": "unpack", "annotation": ""}, "snippet": "\ttup = struct.unpack(struct_fmt, str)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L50_C1", "label": "dict =", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [14, 1, 0.2146, 0.0043, 1, 0.46, 0.0385, 827, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdict = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L52_C1", "label": "assign", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [14, 1, 0.2232, 0.0043, 1, 0.46, 0.0769, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdict['drain'] = tup[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L53_C1", "label": "assign", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [14, 1, 0.2275, 0.0043, 1, 0.46, 0.1154, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdict['shotRepeat'] = tup[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L54_C1", "label": "assign", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [14, 1, 0.2318, 0.0043, 1, 0.46, 0.1538, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdict['multi'] = tup[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L55_C1", "label": "assign", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [14, 1, 0.2361, 0.0043, 1, 0.46, 0.1923, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdict['weapAni'] = tup[3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L56_C1", "label": "assign", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [14, 1, 0.2403, 0.0043, 1, 0.46, 0.2308, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdict['max'] = tup[4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L57_C1", "label": "assign", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [14, 1, 0.2446, 0.0043, 1, 0.46, 0.2692, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdict['tx'] = tup[5]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L58_C1", "label": "assign", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [14, 1, 0.2489, 0.0043, 1, 0.46, 0.3077, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdict['ty'] = tup[6]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L59_C1", "label": "assign", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [14, 1, 0.2532, 0.0043, 1, 0.46, 0.3462, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdict['aim'] = tup[7]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L61_C1", "label": "i =", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [14, 1, 0.2618, 0.0043, 1, 0.46, 0.3846, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ti = 8"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L63_C1", "label": "tmp =", "type": "assigned_variable", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [14, 1, 0.2704, 0.0043, 1, 0.46, 0.4231, 517, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "tmp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttmp = [{} for j in xrange(8)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L64_C1", "label": "for j", "type": "for", "loc": [64, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [6, 1, 0.279, 0.0129, 1, 0.46, 0.4615, 100, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor j in xrange(8):\n\t\ttmp[j]['attack'] = tup[i]\n\t\ti += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L65_C2", "label": "assign", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L64_C1", "vector": [14, 2, 0.279, 0.0043, 2, 0.85, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ttmp[j]['attack'] = tup[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L67_C1", "label": "for j", "type": "for", "loc": [67, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [6, 1, 0.2918, 0.0129, 1, 0.46, 0.5, 100, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor j in xrange(8):\n\t\ttmp[j]['del'] = tup[i]\n\t\ti += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L68_C2", "label": "assign", "type": "assigned_variable", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L67_C1", "vector": [14, 2, 0.2918, 0.0043, 2, 0.81, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ttmp[j]['del'] = tup[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L70_C1", "label": "for j", "type": "for", "loc": [70, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [6, 1, 0.3047, 0.0129, 1, 0.46, 0.5385, 100, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor j in xrange(8):\n\t\ttmp[j]['sx'] = tup[i]\n\t\ti += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L71_C2", "label": "assign", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L70_C1", "vector": [14, 2, 0.3047, 0.0043, 2, 0.92, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ttmp[j]['sx'] = tup[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L73_C1", "label": "for j", "type": "for", "loc": [73, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [6, 1, 0.3176, 0.0129, 1, 0.46, 0.5769, 100, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor j in xrange(8):\n\t\ttmp[j]['sy'] = tup[i]\n\t\ti += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L74_C2", "label": "assign", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L73_C1", "vector": [14, 2, 0.3176, 0.0043, 2, 0.73, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ttmp[j]['sy'] = tup[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L76_C1", "label": "for j", "type": "for", "loc": [76, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [6, 1, 0.3305, 0.0129, 1, 0.46, 0.6154, 100, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor j in xrange(8):\n\t\ttmp[j]['bx'] = tup[i]\n\t\ti += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L77_C2", "label": "assign", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L76_C1", "vector": [14, 2, 0.3305, 0.0043, 2, 0.94, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ttmp[j]['bx'] = tup[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L79_C1", "label": "for j", "type": "for", "loc": [79, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [6, 1, 0.3433, 0.0129, 1, 0.46, 0.6538, 100, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor j in xrange(8):\n\t\ttmp[j]['by'] = tup[i]\n\t\ti += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L80_C2", "label": "assign", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L79_C1", "vector": [14, 2, 0.3433, 0.0043, 2, 0.7, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ttmp[j]['by'] = tup[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L82_C1", "label": "for j", "type": "for", "loc": [82, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [6, 1, 0.3562, 0.0129, 1, 0.46, 0.6923, 100, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor j in xrange(8):\n\t\ttmp[j]['sg'] = tup[i]\n\t\ti += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L83_C2", "label": "assign", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L82_C1", "vector": [14, 2, 0.3562, 0.0043, 2, 0.49, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ttmp[j]['sg'] = tup[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L85_C1", "label": "assign", "type": "assigned_variable", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [14, 1, 0.3648, 0.0043, 1, 0.46, 0.7308, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdict['patterns'] = tmp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L87_C1", "label": "assign", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [14, 1, 0.3734, 0.0043, 1, 0.46, 0.7692, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdict['acceleration'] = tup[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L88_C1", "label": "assign", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [14, 1, 0.3777, 0.0043, 1, 0.46, 0.8077, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdict['accelerationx'] = tup[i+1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L89_C1", "label": "assign", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [14, 1, 0.382, 0.0043, 1, 0.46, 0.8462, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdict['circleSize'] = tup[i+2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L90_C1", "label": "assign", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [14, 1, 0.3863, 0.0043, 1, 0.46, 0.8846, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdict['sound'] = tup[i+3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L91_C1", "label": "assign", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [14, 1, 0.3906, 0.0043, 1, 0.46, 0.9231, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdict['trail'] = tup[i+4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L92_C1", "label": "assign", "type": "assigned_variable", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [14, 1, 0.3948, 0.0043, 1, 0.46, 0.9615, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdict['shipBlastFilter'] = tup[i+5]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Return_L94_C1", "label": "return", "type": "return", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "vector": [13, 1, 0.4034, 0.0043, 1, 0.46, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn dict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L96_C0", "label": "DOMToDict", "type": "function", "loc": [96, 117], "level": 0, "parent": null, "vector": [2, 0, 0.4571, 0.0944, 0, 0.66, 0.5833, 87, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "DOMToDict", "arg_names": ["doc", "weap_node"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def DOMToDict(doc, weap_node):\n\tdict = {}\n\n\tfor i in weap_node.childNodes:\n\t\tif i.nodeType != i.ELEMENT_NODE:\n\t\t\tcontinue\n\n\t\tif i.hasAttribute(\"value\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L97_C1", "label": "dict =", "type": "assigned_variable", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L96_C0", "vector": [14, 1, 0.4163, 0.0043, 1, 0.38, 0.0, 827, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdict = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L99_C1", "label": "for i", "type": "for", "loc": [99, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L96_C0", "vector": [6, 1, 0.4592, 0.073, 1, 0.38, 0.5, 826, 7, 0, 0, 0, 0, 0, 7], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor i in weap_node.childNodes:\n\t\tif i.nodeType != i.ELEMENT_NODE:\n\t\t\tcontinue\n\n\t\tif i.hasAttribute(\"value\"):\n\t\t\tdict[i.tagName] = int(i.getAttribute(\"value\"))\n\t\telif i.tagName == \"patterns\":\n\t\t\tdict['patterns'] = [{} for el in xrange(8)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L100_C2", "label": "if", "type": "if", "loc": [100, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L99_C1", "vector": [4, 2, 0.4313, 0.0086, 2, 0.9, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif i.nodeType != i.ELEMENT_NODE:\n\t\t\tcontinue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L103_C2", "label": "if", "type": "if", "loc": [103, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L99_C1", "vector": [4, 2, 0.4678, 0.0558, 2, 0.9, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif i.hasAttribute(\"value\"):\n\t\t\tdict[i.tagName] = int(i.getAttribute(\"value\"))\n\t\telif i.tagName == \"patterns\":\n\t\t\tdict['patterns'] = [{} for el in xrange(8)]\n\t\t\tindex = 0\n\t\t\tfor j in i.childNodes:\n\t\t\t\tif j.nodeType != i.ELEMENT_NODE:\n\t\t\t\t\tcontinue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L104_C3", "label": " = int()", "type": "assigned_variable", "loc": [104, 104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L103_C2", "vector": [14, 3, 0.4464, 0.0043, 3, 0.42, 0.0, 0, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": "\t\t\tdict[i.tagName] = int(i.getAttribute(\"value\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L105_C2", "label": "if", "type": "if", "loc": [105, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L103_C2", "vector": [4, 3, 0.4721, 0.0472, 3, 0.42, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif i.tagName == \"patterns\":\n\t\t\tdict['patterns'] = [{} for el in xrange(8)]\n\t\t\tindex = 0\n\t\t\tfor j in i.childNodes:\n\t\t\t\tif j.nodeType != i.ELEMENT_NODE:\n\t\t\t\t\tcontinue\n\n\t\t\t\tattrs = [j.attributes.item(i) for i in xrange(j.attributes.length)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L106_C3", "label": "assign", "type": "assigned_variable", "loc": [106, 106], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L105_C2", "vector": [14, 4, 0.4549, 0.0043, 4, 0.94, 0.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tdict['patterns'] = [{} for el in xrange(8)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L107_C3", "label": "index =", "type": "assigned_variable", "loc": [107, 107], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L105_C2", "vector": [14, 4, 0.4592, 0.0043, 4, 0.94, 0.5, 780, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tindex = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L108_C3", "label": "for j", "type": "for", "loc": [108, 115], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L105_C2", "vector": [6, 4, 0.4785, 0.0343, 4, 0.94, 1.0, 100, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tfor j in i.childNodes:\n\t\t\t\tif j.nodeType != i.ELEMENT_NODE:\n\t\t\t\t\tcontinue\n\n\t\t\t\tattrs = [j.attributes.item(i) for i in xrange(j.attributes.length)]\n\t\t\t\tfor i in attrs:\n\t\t\t\t\tdict['patterns'][index][i.name] = int(i.nodeValue)\n\t\t\t\tindex += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L109_C4", "label": "if", "type": "if", "loc": [109, 110], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L108_C3", "vector": [4, 5, 0.47, 0.0086, 5, 0.45, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tif j.nodeType != i.ELEMENT_NODE:\n\t\t\t\t\tcontinue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L112_C4", "label": "attrs =", "type": "assigned_variable", "loc": [112, 112], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L108_C3", "vector": [14, 5, 0.4807, 0.0043, 5, 0.45, 0.5, 251, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "attrs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tattrs = [j.attributes.item(i) for i in xrange(j.attributes.length)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L113_C4", "label": "for i", "type": "for", "loc": [113, 114], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L108_C3", "vector": [6, 5, 0.4871, 0.0086, 5, 0.45, 1.0, 826, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tfor i in attrs:\n\t\t\t\t\tdict['patterns'][index][i.name] = int(i.nodeValue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L114_C5", "label": " = int()", "type": "assigned_variable", "loc": [114, 114], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L113_C4", "vector": [14, 6, 0.4893, 0.0043, 6, 0.95, 0.0, 0, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": "\t\t\t\t\tdict['patterns'][index][i.name] = int(i.nodeValue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Return_L117_C1", "label": "return", "type": "return", "loc": [117, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L96_C0", "vector": [13, 1, 0.5021, 0.0043, 1, 0.38, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn dict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L119_C0", "label": "dictToDOM", "type": "function", "loc": [119, 141], "level": 0, "parent": null, "vector": [2, 0, 0.5579, 0.0987, 0, 0.66, 0.6667, 129, 0, 4, 0, 0, 0, 0, 16], "semantic": {"name": "dictToDOM", "arg_names": ["doc", "root", "dict", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dictToDOM(doc, root, dict, index=None):\n\tentry = doc.createElement(\"weapon\")\n\tif index != None:\n\t\tentry.setAttribute(\"index\", \"%04X\" % (index,))\n\t\n\tkeys = dict.keys()\n\tkeys.sort()\n\tfor i in keys:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L120_C1", "label": "entry = createElement()", "type": "assigned_variable", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L119_C0", "vector": [14, 1, 0.515, 0.0043, 1, 0.84, 0.0, 812, 3, 1, 0, 0, 105, 10, 1], "semantic": {"name": "entry", "arg_names": [], "import_names": [], "rhs_call_name": "createElement", "annotation": ""}, "snippet": "\tentry = doc.createElement(\"weapon\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L121_C1", "label": "if", "type": "if", "loc": [121, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L119_C0", "vector": [4, 1, 0.5215, 0.0086, 1, 0.84, 0.2, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif index != None:\n\t\tentry.setAttribute(\"index\", \"%04X\" % (index,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L122_C2", "label": "setAttribute()", "type": "expression", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L121_C1", "vector": [8, 2, 0.5236, 0.0043, 2, 0.43, 0.0, 398, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setAttribute", "arg_names": [], "import_names": [], "rhs_call_name": "setAttribute", "annotation": ""}, "snippet": "\t\tentry.setAttribute(\"index\", \"%04X\" % (index,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L124_C1", "label": "keys = keys()", "type": "assigned_variable", "loc": [124, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L119_C0", "vector": [14, 1, 0.5322, 0.0043, 1, 0.84, 0.4, 204, 3, 0, 0, 0, 204, 10, 1], "semantic": {"name": "keys", "arg_names": [], "import_names": [], "rhs_call_name": "keys", "annotation": ""}, "snippet": "\tkeys = dict.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L125_C1", "label": "sort()", "type": "expression", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L119_C0", "vector": [8, 1, 0.5365, 0.0043, 1, 0.84, 0.6, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": "\tkeys.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L126_C1", "label": "for i", "type": "for", "loc": [126, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L119_C0", "vector": [6, 1, 0.5687, 0.0601, 1, 0.84, 0.8, 826, 2, 0, 0, 0, 0, 0, 11], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor i in keys:\n\t\tnode = doc.createElement(i)\n\t\tif isinstance(dict[i], list):\n\t\t\tfor j in dict[i]:\n\t\t\t\tkeys = j.keys()\n\t\t\t\tkeys.sort()\n\n\t\t\t\tn = doc.createElement(\"entry\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L127_C2", "label": "node = createElement()", "type": "assigned_variable", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L126_C1", "vector": [14, 2, 0.5451, 0.0043, 2, 0.34, 0.0, 772, 3, 1, 0, 0, 105, 10, 1], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "createElement", "annotation": ""}, "snippet": "\t\tnode = doc.createElement(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L128_C2", "label": "if", "type": "if", "loc": [128, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L126_C1", "vector": [4, 2, 0.5708, 0.0472, 2, 0.34, 0.5, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif isinstance(dict[i], list):\n\t\t\tfor j in dict[i]:\n\t\t\t\tkeys = j.keys()\n\t\t\t\tkeys.sort()\n\n\t\t\t\tn = doc.createElement(\"entry\")\n\t\t\t\tfor i in keys:\n\t\t\t\t\tn.setAttribute(i, str(j[i]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L129_C3", "label": "for j", "type": "for", "loc": [129, 136], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L128_C2", "vector": [6, 3, 0.5687, 0.0343, 3, 0.74, 0.0, 100, 6, 0, 0, 0, 0, 0, 6], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tfor j in dict[i]:\n\t\t\t\tkeys = j.keys()\n\t\t\t\tkeys.sort()\n\n\t\t\t\tn = doc.createElement(\"entry\")\n\t\t\t\tfor i in keys:\n\t\t\t\t\tn.setAttribute(i, str(j[i]))\n\t\t\t\tnode.appendChild(n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L130_C4", "label": "keys = keys()", "type": "assigned_variable", "loc": [130, 130], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L129_C3", "vector": [14, 4, 0.5579, 0.0043, 4, 0.16, 0.0, 204, 3, 0, 0, 0, 204, 10, 1], "semantic": {"name": "keys", "arg_names": [], "import_names": [], "rhs_call_name": "keys", "annotation": ""}, "snippet": "\t\t\t\tkeys = j.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L131_C4", "label": "sort()", "type": "expression", "loc": [131, 131], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L129_C3", "vector": [8, 4, 0.5622, 0.0043, 4, 0.16, 0.25, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": "\t\t\t\tkeys.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L133_C4", "label": "n = createElement()", "type": "assigned_variable", "loc": [133, 133], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L129_C3", "vector": [14, 4, 0.5708, 0.0043, 4, 0.16, 0.5, 773, 3, 1, 0, 0, 105, 10, 1], "semantic": {"name": "n", "arg_names": [], "import_names": [], "rhs_call_name": "createElement", "annotation": ""}, "snippet": "\t\t\t\tn = doc.createElement(\"entry\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L134_C4", "label": "for i", "type": "for", "loc": [134, 135], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L129_C3", "vector": [6, 4, 0.5773, 0.0086, 4, 0.16, 0.75, 826, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tfor i in keys:\n\t\t\t\t\tn.setAttribute(i, str(j[i]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L135_C5", "label": "setAttribute()", "type": "expression", "loc": [135, 135], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L134_C4", "vector": [8, 5, 0.5794, 0.0043, 5, 0.86, 0.0, 398, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "setAttribute", "arg_names": [], "import_names": [], "rhs_call_name": "setAttribute", "annotation": ""}, "snippet": "\t\t\t\t\tn.setAttribute(i, str(j[i]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L136_C4", "label": "appendChild()", "type": "expression", "loc": [136, 136], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L129_C3", "vector": [8, 4, 0.5837, 0.0043, 4, 0.16, 1.0, 699, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "appendChild", "arg_names": [], "import_names": [], "rhs_call_name": "appendChild", "annotation": ""}, "snippet": "\t\t\t\tnode.appendChild(n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L138_C3", "label": "setAttribute()", "type": "expression", "loc": [138, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L128_C2", "vector": [8, 3, 0.5923, 0.0043, 3, 0.74, 1.0, 398, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "setAttribute", "arg_names": [], "import_names": [], "rhs_call_name": "setAttribute", "annotation": ""}, "snippet": "\t\t\tnode.setAttribute(\"value\", str(dict[i]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L139_C2", "label": "appendChild()", "type": "expression", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L126_C1", "vector": [8, 2, 0.5966, 0.0043, 2, 0.34, 1.0, 699, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "appendChild", "arg_names": [], "import_names": [], "rhs_call_name": "appendChild", "annotation": ""}, "snippet": "\t\tentry.appendChild(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L141_C1", "label": "appendChild()", "type": "expression", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L119_C0", "vector": [8, 1, 0.6052, 0.0043, 1, 0.84, 1.0, 699, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "appendChild", "arg_names": [], "import_names": [], "rhs_call_name": "appendChild", "annotation": ""}, "snippet": "\troot.appendChild(entry)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "label": "toXML", "type": "function", "loc": [143, 178], "level": 0, "parent": null, "vector": [2, 0, 0.6888, 0.1545, 0, 0.66, 0.75, 921, 0, 2, 0, 0, 0, 0, 25], "semantic": {"name": "toXML", "arg_names": ["hdt", "output"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def toXML(hdt, output):\n\tdoc = dom.getDOMImplementation().createDocument(None, \"TyrianHDT\", None)\n\n\ttry:\n\t\tf = file(hdt, \"rb\")\n\texcept IOError:\n\t\tprint(\"%s couldn't be opened for reading.\" % (hdt,))\n\t\tsys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L144_C1", "label": "doc = createDocument()", "type": "assigned_variable", "loc": [144, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "vector": [14, 1, 0.618, 0.0043, 1, 0.33, 0.0, 555, 3, 3, 0, 0, 891, 10, 2], "semantic": {"name": "doc", "arg_names": [], "import_names": [], "rhs_call_name": "createDocument", "annotation": ""}, "snippet": "\tdoc = dom.getDOMImplementation().createDocument(None, \"TyrianHDT\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L146_C1", "label": "try", "type": "try", "loc": [146, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "vector": [7, 1, 0.6352, 0.0215, 1, 0.33, 0.0833, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttry:\n\t\tf = file(hdt, \"rb\")\n\texcept IOError:\n\t\tprint(\"%s couldn't be opened for reading.\" % (hdt,))\n\t\tsys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L147_C2", "label": "f = file()", "type": "assigned_variable", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L146_C1", "vector": [14, 2, 0.6309, 0.0043, 2, 0.12, 0.0, 899, 3, 2, 0, 0, 107, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "file", "annotation": ""}, "snippet": "\t\tf = file(hdt, \"rb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L149_C2", "label": "print()", "type": "expression", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L146_C1", "vector": [8, 2, 0.6395, 0.0043, 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": "\t\tprint(\"%s couldn't be opened for reading.\" % (hdt,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L150_C2", "label": "exit()", "type": "expression", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L146_C1", "vector": [8, 2, 0.6438, 0.0043, 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": "\t\tsys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L152_C1", "label": "try", "type": "try", "loc": [152, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "vector": [7, 1, 0.6609, 0.0215, 1, 0.33, 0.1667, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttry:\n\t\toutf = file(output, \"w\")\n\texcept IOError:\n\t\tprint(\"%s couldn't be opened for writing.\" % (outf,))\n\t\tsys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L153_C2", "label": "outf = file()", "type": "assigned_variable", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L152_C1", "vector": [14, 2, 0.6567, 0.0043, 2, 0.25, 0.0, 808, 3, 2, 0, 0, 107, 10, 1], "semantic": {"name": "outf", "arg_names": [], "import_names": [], "rhs_call_name": "file", "annotation": ""}, "snippet": "\t\toutf = file(output, \"w\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L155_C2", "label": "print()", "type": "expression", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L152_C1", "vector": [8, 2, 0.6652, 0.0043, 2, 0.25, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint(\"%s couldn't be opened for writing.\" % (outf,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L156_C2", "label": "exit()", "type": "expression", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L152_C1", "vector": [8, 2, 0.6695, 0.0043, 2, 0.25, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\tsys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L158_C1", "label": "seek()", "type": "expression", "loc": [158, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "vector": [8, 1, 0.6781, 0.0043, 1, 0.33, 0.25, 66, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "seek", "arg_names": [], "import_names": [], "rhs_call_name": "seek", "annotation": ""}, "snippet": "\tf.seek(struct.unpack(\"<i\", f.read(4))[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L159_C1", "label": "read()", "type": "expression", "loc": [159, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "vector": [8, 1, 0.6824, 0.0043, 1, 0.33, 0.3333, 453, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "read", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": "\tf.read(7*2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L162_C1", "label": "write()", "type": "expression", "loc": [162, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "vector": [8, 1, 0.6953, 0.0043, 1, 0.33, 0.4167, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "\tsys.stdout.write(\"Converting weapons\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L163_C1", "label": "index =", "type": "assigned_variable", "loc": [163, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "vector": [14, 1, 0.6996, 0.0043, 1, 0.33, 0.5, 780, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tindex = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L165_C1", "label": "for i", "type": "for", "loc": [165, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "vector": [6, 1, 0.7232, 0.0343, 1, 0.33, 0.5833, 826, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor i in xrange(WEAP_NUM+1):\n\t\ttmp = f.read(struct.calcsize(struct_fmt))\n\t\tshot = unpack_weapon(tmp)\n\t\tdictToDOM(doc, doc.documentElement, shot, index)\n\t\tindex += 1\n\n\t\tsys.stdout.write(\".\")\n\t\tsys.stdout.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L166_C2", "label": "tmp = read()", "type": "assigned_variable", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L165_C1", "vector": [14, 2, 0.7124, 0.0043, 2, 0.48, 0.0, 517, 3, 1, 0, 0, 453, 10, 2], "semantic": {"name": "tmp", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": "\t\ttmp = f.read(struct.calcsize(struct_fmt))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L167_C2", "label": "shot = unpack_weapon()", "type": "assigned_variable", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L165_C1", "vector": [14, 2, 0.7167, 0.0043, 2, 0.48, 0.25, 450, 3, 1, 0, 0, 173, 10, 1], "semantic": {"name": "shot", "arg_names": [], "import_names": [], "rhs_call_name": "unpack_weapon", "annotation": ""}, "snippet": "\t\tshot = unpack_weapon(tmp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L168_C2", "label": "dictToDOM()", "type": "expression", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L165_C1", "vector": [8, 2, 0.721, 0.0043, 2, 0.48, 0.5, 129, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "dictToDOM", "arg_names": [], "import_names": [], "rhs_call_name": "dictToDOM", "annotation": ""}, "snippet": "\t\tdictToDOM(doc, doc.documentElement, shot, index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L171_C2", "label": "write()", "type": "expression", "loc": [171, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L165_C1", "vector": [8, 2, 0.7339, 0.0043, 2, 0.48, 0.75, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "\t\tsys.stdout.write(\".\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L172_C2", "label": "flush()", "type": "expression", "loc": [172, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L165_C1", "vector": [8, 2, 0.7382, 0.0043, 2, 0.48, 1.0, 439, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "flush", "arg_names": [], "import_names": [], "rhs_call_name": "flush", "annotation": ""}, "snippet": "\t\tsys.stdout.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L174_C1", "label": "write()", "type": "expression", "loc": [174, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "vector": [8, 1, 0.7468, 0.0043, 1, 0.33, 0.6667, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "\tsys.stdout.write(\"Done!\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L175_C1", "label": "write()", "type": "expression", "loc": [175, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "vector": [8, 1, 0.7511, 0.0043, 1, 0.33, 0.75, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "\tsys.stdout.write(\"Writing XML...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L176_C1", "label": "flush()", "type": "expression", "loc": [176, 176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "vector": [8, 1, 0.7554, 0.0043, 1, 0.33, 0.8333, 439, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "flush", "arg_names": [], "import_names": [], "rhs_call_name": "flush", "annotation": ""}, "snippet": "\tsys.stdout.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L177_C1", "label": "writexml()", "type": "expression", "loc": [177, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "vector": [8, 1, 0.7597, 0.0043, 1, 0.33, 0.9167, 88, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "writexml", "arg_names": [], "import_names": [], "rhs_call_name": "writexml", "annotation": ""}, "snippet": "\tdoc.writexml(outf, addindent=\"\\t\", newl=\"\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L178_C1", "label": "write()", "type": "expression", "loc": [178, 178], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "vector": [8, 1, 0.7639, 0.0043, 1, 0.33, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "\tsys.stdout.write(\"Done!\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "label": "toHDT", "type": "function", "loc": [180, 215], "level": 0, "parent": null, "vector": [2, 0, 0.8476, 0.1545, 0, 0.66, 0.8333, 67, 0, 2, 0, 0, 0, 0, 21], "semantic": {"name": "toHDT", "arg_names": ["input", "hdt"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def toHDT(input, hdt):\n\ttry:\n\t\tf = file(input, \"r\")\n\texcept IOError:\n\t\tprint(\"%s couldn't be opened for reading.\" % (input,))\n\t\tsys.exit(1)\n\n\ttry:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L181_C1", "label": "try", "type": "try", "loc": [181, 185], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "vector": [7, 1, 0.7854, 0.0215, 1, 0.07, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttry:\n\t\tf = file(input, \"r\")\n\texcept IOError:\n\t\tprint(\"%s couldn't be opened for reading.\" % (input,))\n\t\tsys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L182_C2", "label": "f = file()", "type": "assigned_variable", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L181_C1", "vector": [14, 2, 0.7811, 0.0043, 2, 0.57, 0.0, 899, 3, 2, 0, 0, 107, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "file", "annotation": ""}, "snippet": "\t\tf = file(input, \"r\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L184_C2", "label": "print()", "type": "expression", "loc": [184, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L181_C1", "vector": [8, 2, 0.7897, 0.0043, 2, 0.57, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint(\"%s couldn't be opened for reading.\" % (input,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L185_C2", "label": "exit()", "type": "expression", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L181_C1", "vector": [8, 2, 0.794, 0.0043, 2, 0.57, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\tsys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L187_C1", "label": "try", "type": "try", "loc": [187, 191], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "vector": [7, 1, 0.8112, 0.0215, 1, 0.07, 0.1, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttry:\n\t\toutf = file(hdt, \"r+b\")\n\texcept IOError:\n\t\tprint(\"%s couldn't be opened for writing.\" % (hdt,))\n\t\tsys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L188_C2", "label": "outf = file()", "type": "assigned_variable", "loc": [188, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L187_C1", "vector": [14, 2, 0.8069, 0.0043, 2, 0.97, 0.0, 808, 3, 2, 0, 0, 107, 10, 1], "semantic": {"name": "outf", "arg_names": [], "import_names": [], "rhs_call_name": "file", "annotation": ""}, "snippet": "\t\toutf = file(hdt, \"r+b\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L190_C2", "label": "print()", "type": "expression", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L187_C1", "vector": [8, 2, 0.8155, 0.0043, 2, 0.97, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint(\"%s couldn't be opened for writing.\" % (hdt,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L191_C2", "label": "exit()", "type": "expression", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L187_C1", "vector": [8, 2, 0.8197, 0.0043, 2, 0.97, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\tsys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L193_C1", "label": "seek()", "type": "expression", "loc": [193, 193], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "vector": [8, 1, 0.8283, 0.0043, 1, 0.07, 0.2, 66, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "seek", "arg_names": [], "import_names": [], "rhs_call_name": "seek", "annotation": ""}, "snippet": "\toutf.seek(struct.unpack(\"<i\", outf.read(4))[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L194_C1", "label": "read()", "type": "expression", "loc": [194, 194], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "vector": [8, 1, 0.8326, 0.0043, 1, 0.07, 0.3, 453, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "read", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": "\toutf.read(7*2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L196_C1", "label": "write()", "type": "expression", "loc": [196, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "vector": [8, 1, 0.8412, 0.0043, 1, 0.07, 0.4, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "\tsys.stdout.write(\"Reading XML...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L197_C1", "label": "flush()", "type": "expression", "loc": [197, 197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "vector": [8, 1, 0.8455, 0.0043, 1, 0.07, 0.5, 439, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "flush", "arg_names": [], "import_names": [], "rhs_call_name": "flush", "annotation": ""}, "snippet": "\tsys.stdout.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L198_C1", "label": "doc = parse()", "type": "assigned_variable", "loc": [198, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "vector": [14, 1, 0.8498, 0.0043, 1, 0.07, 0.6, 555, 3, 1, 0, 0, 678, 10, 1], "semantic": {"name": "doc", "arg_names": [], "import_names": [], "rhs_call_name": "parse", "annotation": ""}, "snippet": "\tdoc = dom.parse(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L199_C1", "label": "write()", "type": "expression", "loc": [199, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "vector": [8, 1, 0.8541, 0.0043, 1, 0.07, 0.7, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "\tsys.stdout.write(\"Done!\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L201_C1", "label": "write()", "type": "expression", "loc": [201, 201], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "vector": [8, 1, 0.8627, 0.0043, 1, 0.07, 0.8, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "\tsys.stdout.write(\"Writing weapons\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L203_C1", "label": "for i", "type": "for", "loc": [203, 213], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "vector": [6, 1, 0.8927, 0.0472, 1, 0.07, 0.9, 826, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor i in doc.documentElement.childNodes:\n\t\tif i.nodeType != i.ELEMENT_NODE:\n\t\t\tcontinue\n\n\t\tshot = DOMToDict(doc, i)\n\t\tstr = pack_weapon(shot)\n\n\t\toutf.write(str)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L204_C2", "label": "if", "type": "if", "loc": [204, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L203_C1", "vector": [4, 2, 0.8777, 0.0086, 2, 0.32, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif i.nodeType != i.ELEMENT_NODE:\n\t\t\tcontinue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L207_C2", "label": "shot = DOMToDict()", "type": "assigned_variable", "loc": [207, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L203_C1", "vector": [14, 2, 0.8884, 0.0043, 2, 0.32, 0.2, 450, 3, 2, 0, 0, 87, 10, 1], "semantic": {"name": "shot", "arg_names": [], "import_names": [], "rhs_call_name": "DOMToDict", "annotation": ""}, "snippet": "\t\tshot = DOMToDict(doc, i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L208_C2", "label": "str = pack_weapon()", "type": "assigned_variable", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L203_C1", "vector": [14, 2, 0.8927, 0.0043, 2, 0.32, 0.4, 52, 3, 1, 0, 0, 979, 10, 1], "semantic": {"name": "str", "arg_names": [], "import_names": [], "rhs_call_name": "pack_weapon", "annotation": ""}, "snippet": "\t\tstr = pack_weapon(shot)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L210_C2", "label": "write()", "type": "expression", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L203_C1", "vector": [8, 2, 0.9013, 0.0043, 2, 0.32, 0.6, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "\t\toutf.write(str)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L212_C2", "label": "write()", "type": "expression", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L203_C1", "vector": [8, 2, 0.9099, 0.0043, 2, 0.32, 0.8, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "\t\tsys.stdout.write(\".\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L213_C2", "label": "flush()", "type": "expression", "loc": [213, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L203_C1", "vector": [8, 2, 0.9142, 0.0043, 2, 0.32, 1.0, 439, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "flush", "arg_names": [], "import_names": [], "rhs_call_name": "flush", "annotation": ""}, "snippet": "\t\tsys.stdout.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L215_C1", "label": "write()", "type": "expression", "loc": [215, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "vector": [8, 1, 0.9227, 0.0043, 1, 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": "\tsys.stdout.write(\"Done!\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L217_C0", "label": "printHelp", "type": "function", "loc": [217, 220], "level": 0, "parent": null, "vector": [2, 0, 0.9378, 0.0172, 0, 0.66, 0.9167, 923, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "printHelp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def printHelp():\n\tprint(\"Usage: weapons.py toxml path/to/tyrian.hdt output.xml\")\n\tprint(\" weapons.py tohdt input.xml path/to/tyrian.hdt\")\n\tsys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L218_C1", "label": "print()", "type": "expression", "loc": [218, 218], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L217_C0", "vector": [8, 1, 0.9356, 0.0043, 1, 0.29, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\tprint(\"Usage: weapons.py toxml path/to/tyrian.hdt output.xml\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L219_C1", "label": "print()", "type": "expression", "loc": [219, 219], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L217_C0", "vector": [8, 1, 0.9399, 0.0043, 1, 0.29, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\tprint(\" weapons.py tohdt input.xml path/to/tyrian.hdt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L220_C1", "label": "exit()", "type": "expression", "loc": [220, 220], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L217_C0", "vector": [8, 1, 0.9442, 0.0043, 1, 0.29, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\tsys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L224_C0", "label": "if", "type": "if", "loc": [224, 233], "level": 0, "parent": null, "vector": [4, 0, 0.9807, 0.0429, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n\tif len(sys.argv) != 4:\n\t\tprintHelp()\n\n\tif sys.argv[1] == \"toxml\":\n\t\ttoXML(sys.argv[2], sys.argv[3])\n\telif sys.argv[1] == \"tohdt\":\n\t\ttoHDT(sys.argv[2], sys.argv[3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L225_C1", "label": "if", "type": "if", "loc": [225, 226], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L224_C0", "vector": [4, 1, 0.9678, 0.0086, 1, 0.35, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif len(sys.argv) != 4:\n\t\tprintHelp()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L226_C2", "label": "printHelp()", "type": "expression", "loc": [226, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L225_C1", "vector": [8, 2, 0.97, 0.0043, 2, 0.11, 0.0, 923, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "printHelp", "arg_names": [], "import_names": [], "rhs_call_name": "printHelp", "annotation": ""}, "snippet": "\t\tprintHelp()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L228_C1", "label": "if", "type": "if", "loc": [228, 233], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L224_C0", "vector": [4, 1, 0.9893, 0.0258, 1, 0.35, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif sys.argv[1] == \"toxml\":\n\t\ttoXML(sys.argv[2], sys.argv[3])\n\telif sys.argv[1] == \"tohdt\":\n\t\ttoHDT(sys.argv[2], sys.argv[3])\n\telse:\n\t\tprintHelp()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L229_C2", "label": "toXML()", "type": "expression", "loc": [229, 229], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L228_C1", "vector": [8, 2, 0.9828, 0.0043, 2, 0.21, 0.0, 921, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "toXML", "arg_names": [], "import_names": [], "rhs_call_name": "toXML", "annotation": ""}, "snippet": "\t\ttoXML(sys.argv[2], sys.argv[3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L230_C1", "label": "if", "type": "if", "loc": [230, 233], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L228_C1", "vector": [4, 2, 0.9936, 0.0172, 2, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\telif sys.argv[1] == \"tohdt\":\n\t\ttoHDT(sys.argv[2], sys.argv[3])\n\telse:\n\t\tprintHelp()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L231_C2", "label": "toHDT()", "type": "expression", "loc": [231, 231], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L230_C1", "vector": [8, 3, 0.9914, 0.0043, 3, 0.34, 0.0, 67, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "toHDT", "arg_names": [], "import_names": [], "rhs_call_name": "toHDT", "annotation": ""}, "snippet": "\t\ttoHDT(sys.argv[2], sys.argv[3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L233_C2", "label": "printHelp()", "type": "expression", "loc": [233, 233], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L230_C1", "vector": [8, 3, 1.0, 0.0043, 3, 0.34, 1.0, 923, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "printHelp", "arg_names": [], "import_names": [], "rhs_call_name": "printHelp", "annotation": ""}, "snippet": "\t\tprintHelp()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L12_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L14_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L15_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L16_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L17_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L18_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L19_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L20_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L21_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L23_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L24_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L24_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L26_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L26_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L28_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L28_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L30_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L30_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L32_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L32_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L34_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L34_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L36_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L36_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L39_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L40_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L41_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L42_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L43_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L44_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Return_L46_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L49_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L50_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L52_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L53_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L54_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L55_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L56_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L57_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L58_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L59_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L61_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L63_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L64_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L64_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L67_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L67_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L70_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L70_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L73_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L73_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L76_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L76_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L79_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L79_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L82_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L82_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L85_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L87_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L88_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L89_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L90_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L91_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L92_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Return_L94_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L97_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L99_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L99_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L100_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L99_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L103_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L104_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L105_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L105_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L106_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L105_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L107_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L105_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L108_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L108_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L108_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L108_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L114_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Return_L117_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L120_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L121_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L121_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L122_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L124_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L125_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L126_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L126_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L127_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L126_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L128_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L128_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L129_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L129_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L129_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L129_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L129_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L135_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L129_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L128_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L138_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L126_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L139_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L141_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L144_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L146_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L146_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L147_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L146_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L149_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L146_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L150_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L152_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L152_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L153_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L152_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L155_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L152_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L156_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L158_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L159_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L162_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L163_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L165_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L165_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L166_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L165_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L167_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L165_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L168_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L165_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L171_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L165_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L172_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L174_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L175_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L176_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L177_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L178_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L181_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L181_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L182_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L181_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L184_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L181_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L185_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L187_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L187_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L188_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L187_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L190_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:Try_L187_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L191_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L193_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L194_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L196_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L197_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L198_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L199_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L201_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L203_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L203_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L204_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L203_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L207_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L203_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Assign_L208_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L203_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L210_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L203_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L212_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:For_L203_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L213_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L215_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L217_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L218_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L217_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L219_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:FunctionDef_L217_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L220_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L224_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L225_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L225_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L226_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L224_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L228_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L228_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L229_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L228_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L230_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L230_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L231_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1377:If_L230_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1377:Expr_L233_C2"}] |
# -*- coding: utf-8 -*-
#
# jQuery File Upload Plugin GAE Python Example 2.1.0
# https://github.com/blueimp/jQuery-File-Upload
#
# Copyright 2011, Sebastian Tschan
# https://blueimp.net
#
# Licensed under the MIT license:
# http://www.opensource.org/licenses/MIT
#
from __future__ import with_statement
from google.appengine.api import files, images
from google.appengine.ext import blobstore, deferred
from google.appengine.ext.webapp import blobstore_handlers
import json
import re
import urllib
import webapp2
WEBSITE = 'http://blueimp.github.io/jQuery-File-Upload/'
MIN_FILE_SIZE = 1 # bytes
MAX_FILE_SIZE = 5000000 # bytes
IMAGE_TYPES = re.compile('image/(gif|p?jpeg|(x-)?png)')
ACCEPT_FILE_TYPES = IMAGE_TYPES
THUMBNAIL_MODIFICATOR = '=s80' # max width / height
EXPIRATION_TIME = 300 # seconds
def cleanup(blob_keys):
blobstore.delete(blob_keys)
class UploadHandler(webapp2.RequestHandler):
def initialize(self, request, response):
super(UploadHandler, self).initialize(request, response)
self.response.headers['Access-Control-Allow-Origin'] = '*'
self.response.headers[
'Access-Control-Allow-Methods'
] = 'OPTIONS, HEAD, GET, POST, PUT, DELETE'
self.response.headers[
'Access-Control-Allow-Headers'
] = 'Content-Type, Content-Range, Content-Disposition'
def validate(self, file):
if file['size'] < MIN_FILE_SIZE:
file['error'] = 'File is too small'
elif file['size'] > MAX_FILE_SIZE:
file['error'] = 'File is too big'
elif not ACCEPT_FILE_TYPES.match(file['type']):
file['error'] = 'Filetype not allowed'
else:
return True
return False
def get_file_size(self, file):
file.seek(0, 2) # Seek to the end of the file
size = file.tell() # Get the position of EOF
file.seek(0) # Reset the file position to the beginning
return size
def write_blob(self, data, info):
blob = files.blobstore.create(
mime_type=info['type'],
_blobinfo_uploaded_filename=info['name']
)
with files.open(blob, 'a') as f:
f.write(data)
files.finalize(blob)
return files.blobstore.get_blob_key(blob)
def handle_upload(self):
results = []
blob_keys = []
for name, fieldStorage in self.request.POST.items():
if type(fieldStorage) is unicode:
continue
result = {}
result['name'] = re.sub(
r'^.*\\',
'',
fieldStorage.filename
)
result['type'] = fieldStorage.type
result['size'] = self.get_file_size(fieldStorage.file)
if self.validate(result):
blob_key = str(
self.write_blob(fieldStorage.value, result)
)
blob_keys.append(blob_key)
result['deleteType'] = 'DELETE'
result['deleteUrl'] = self.request.host_url +\
'/?key=' + urllib.quote(blob_key, '')
if (IMAGE_TYPES.match(result['type'])):
try:
result['url'] = images.get_serving_url(
blob_key,
secure_url=self.request.host_url.startswith(
'https'
)
)
result['thumbnailUrl'] = result['url'] +\
THUMBNAIL_MODIFICATOR
except: # Could not get an image serving url
pass
if not 'url' in result:
result['url'] = self.request.host_url +\
'/' + blob_key + '/' + urllib.quote(
result['name'].encode('utf-8'), '')
results.append(result)
deferred.defer(
cleanup,
blob_keys,
_countdown=EXPIRATION_TIME
)
return results
def options(self):
pass
def head(self):
pass
def get(self):
self.redirect(WEBSITE)
def post(self):
if (self.request.get('_method') == 'DELETE'):
return self.delete()
result = {'files': self.handle_upload()}
s = json.dumps(result, separators=(',', ':'))
redirect = self.request.get('redirect')
if redirect:
return self.redirect(str(
redirect.replace('%s', urllib.quote(s, ''), 1)
))
if 'application/json' in self.request.headers.get('Accept'):
self.response.headers['Content-Type'] = 'application/json'
self.response.write(s)
def delete(self):
blobstore.delete(self.request.get('key') or '')
class DownloadHandler(blobstore_handlers.BlobstoreDownloadHandler):
def get(self, key, filename):
if not blobstore.get(key):
self.error(404)
else:
# Prevent browsers from MIME-sniffing the content-type:
self.response.headers['X-Content-Type-Options'] = 'nosniff'
# Cache for the expiration time:
self.response.headers['Cache-Control'] = 'public,max-age=%d' % EXPIRATION_TIME
# Send the file forcing a download dialog:
self.send_blob(key, save_as=filename, content_type='application/octet-stream')
app = webapp2.WSGIApplication(
[
('/', UploadHandler),
('/([^/]+)/([^/]+)', DownloadHandler)
],
debug=True
)
| ajibawa-2023/Python-Code-Large/train/row_1378 | 90 | 165 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1378:ImportFrom_L13_C0", "label": "from __future__ import with_statement", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0788, 0.0061, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "import_names": ["with_statement"], "rhs_call_name": "", "annotation": ""}, "snippet": "from __future__ import with_statement"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:ImportFrom_L14_C0", "label": "from google.appengine.api import files, images", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0848, 0.0061, 0, 0.66, 0.0556, 279, 0, 2, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names": [], "import_names": ["files", "images"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.api import files, images"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:ImportFrom_L15_C0", "label": "from google.appengine.ext import blobstore, deferred", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0061, 0, 0.66, 0.1111, 167, 0, 2, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["blobstore", "deferred"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import blobstore, deferred"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:ImportFrom_L16_C0", "label": "from google.appengine.ext.webapp import blobstore_handlers", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.097, 0.0061, 0, 0.66, 0.1667, 8, 0, 1, 0, 0, 8, 0, 0], "semantic": {"name": "google.appengine.ext.webapp", "arg_names": [], "import_names": ["blobstore_handlers"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext.webapp import blobstore_handlers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Import_L17_C0", "label": "json import json", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.103, 0.0061, 0, 0.66, 0.2222, 463, 0, 1, 0, 0, 463, 0, 0], "semantic": {"name": "json", "arg_names": [], "import_names": ["json"], "rhs_call_name": "", "annotation": ""}, "snippet": "import json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Import_L18_C0", "label": "re import re", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1091, 0.0061, 0, 0.66, 0.2778, 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_1378:Import_L19_C0", "label": "urllib import urllib", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1152, 0.0061, 0, 0.66, 0.3333, 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_1378:Import_L20_C0", "label": "webapp2 import webapp2", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.1212, 0.0061, 0, 0.66, 0.3889, 123, 0, 1, 0, 0, 123, 0, 0], "semantic": {"name": "webapp2", "arg_names": [], "import_names": ["webapp2"], "rhs_call_name": "", "annotation": ""}, "snippet": "import webapp2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L22_C0", "label": "WEBSITE =", "type": "assigned_variable", "loc": [22, 22], "level": 0, "parent": null, "vector": [14, 0, 0.1333, 0.0061, 0, 0.66, 0.4444, 713, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "WEBSITE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WEBSITE = 'http://blueimp.github.io/jQuery-File-Upload/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L23_C0", "label": "MIN_FILE_SIZE =", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.1394, 0.0061, 0, 0.66, 0.5, 165, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "MIN_FILE_SIZE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MIN_FILE_SIZE = 1 # bytes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L24_C0", "label": "MAX_FILE_SIZE =", "type": "assigned_variable", "loc": [24, 24], "level": 0, "parent": null, "vector": [14, 0, 0.1455, 0.0061, 0, 0.66, 0.5556, 149, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "MAX_FILE_SIZE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MAX_FILE_SIZE = 5000000 # bytes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L25_C0", "label": "IMAGE_TYPES = compile()", "type": "assigned_variable", "loc": [25, 25], "level": 0, "parent": null, "vector": [14, 0, 0.1515, 0.0061, 0, 0.66, 0.6111, 298, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "IMAGE_TYPES", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "IMAGE_TYPES = re.compile('image/(gif|p?jpeg|(x-)?png)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L26_C0", "label": "ACCEPT_FILE_TYPES =", "type": "assigned_variable", "loc": [26, 26], "level": 0, "parent": null, "vector": [14, 0, 0.1576, 0.0061, 0, 0.66, 0.6667, 16, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ACCEPT_FILE_TYPES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ACCEPT_FILE_TYPES = IMAGE_TYPES"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L27_C0", "label": "THUMBNAIL_MODIFICATOR =", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.1636, 0.0061, 0, 0.66, 0.7222, 39, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "THUMBNAIL_MODIFICATOR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "THUMBNAIL_MODIFICATOR = '=s80' # max width / height"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L28_C0", "label": "EXPIRATION_TIME =", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.1697, 0.0061, 0, 0.66, 0.7778, 745, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "EXPIRATION_TIME", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "EXPIRATION_TIME = 300 # seconds"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L31_C0", "label": "cleanup", "type": "function", "loc": [31, 32], "level": 0, "parent": null, "vector": [2, 0, 0.1909, 0.0121, 0, 0.66, 0.8333, 656, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "cleanup", "arg_names": ["blob_keys"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def cleanup(blob_keys):\n blobstore.delete(blob_keys)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L32_C4", "label": "delete()", "type": "expression", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L31_C0", "vector": [8, 1, 0.1939, 0.0061, 1, 0.45, 0.0, 266, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " blobstore.delete(blob_keys)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "label": "UploadHandler", "type": "class", "loc": [35, 144], "level": 0, "parent": null, "vector": [3, 0, 0.5424, 0.6667, 0, 0.66, 0.8889, 353, 0, 10, 0, 0, 842, 0, 41], "semantic": {"name": "UploadHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class UploadHandler(webapp2.RequestHandler):\n\n def initialize(self, request, response):\n super(UploadHandler, self).initialize(request, response)\n self.response.headers['Access-Control-Allow-Origin'] = '*'\n self.response.headers[\n 'Access-Control-Allow-Methods'\n ] = 'OPTIONS, HEAD, GET, POST, PUT, DELETE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L37_C4", "label": "initialize", "type": "function", "loc": [37, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "vector": [2, 1, 0.2485, 0.0545, 1, 0.83, 0.0, 393, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "initialize", "arg_names": ["self", "request", "response"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def initialize(self, request, response):\n super(UploadHandler, self).initialize(request, response)\n self.response.headers['Access-Control-Allow-Origin'] = '*'\n self.response.headers[\n 'Access-Control-Allow-Methods'\n ] = 'OPTIONS, HEAD, GET, POST, PUT, DELETE'\n self.response.headers[\n 'Access-Control-Allow-Headers'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L38_C8", "label": "initialize()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L37_C4", "vector": [8, 2, 0.2303, 0.0061, 2, 0.66, 0.0, 393, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "initialize", "arg_names": [], "import_names": [], "rhs_call_name": "initialize", "annotation": ""}, "snippet": " super(UploadHandler, self).initialize(request, response)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L39_C8", "label": "assign", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L37_C4", "vector": [14, 2, 0.2364, 0.0061, 2, 0.66, 0.3333, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.response.headers['Access-Control-Allow-Origin'] = '*'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L40_C8", "label": "assign", "type": "assigned_variable", "loc": [40, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L37_C4", "vector": [14, 2, 0.2485, 0.0182, 2, 0.66, 0.6667, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.response.headers[\n 'Access-Control-Allow-Methods'\n ] = 'OPTIONS, HEAD, GET, POST, PUT, DELETE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L43_C8", "label": "assign", "type": "assigned_variable", "loc": [43, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L37_C4", "vector": [14, 2, 0.2667, 0.0182, 2, 0.66, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.response.headers[\n 'Access-Control-Allow-Headers'\n ] = 'Content-Type, Content-Range, Content-Disposition'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L47_C4", "label": "validate", "type": "function", "loc": [47, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "vector": [2, 1, 0.3121, 0.0606, 1, 0.83, 0.1111, 628, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "validate", "arg_names": ["self", "file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def validate(self, file):\n if file['size'] < MIN_FILE_SIZE:\n file['error'] = 'File is too small'\n elif file['size'] > MAX_FILE_SIZE:\n file['error'] = 'File is too big'\n elif not ACCEPT_FILE_TYPES.match(file['type']):\n file['error'] = 'Filetype not allowed'\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L48_C8", "label": "if", "type": "if", "loc": [48, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L47_C4", "vector": [4, 2, 0.3121, 0.0485, 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 file['size'] < MIN_FILE_SIZE:\n file['error'] = 'File is too small'\n elif file['size'] > MAX_FILE_SIZE:\n file['error'] = 'File is too big'\n elif not ACCEPT_FILE_TYPES.match(file['type']):\n file['error'] = 'Filetype not allowed'\n else:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L49_C12", "label": "assign", "type": "assigned_variable", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L48_C8", "vector": [14, 3, 0.297, 0.0061, 3, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " file['error'] = 'File is too small'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L50_C8", "label": "if", "type": "if", "loc": [50, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L48_C8", "vector": [4, 3, 0.3182, 0.0364, 3, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif file['size'] > MAX_FILE_SIZE:\n file['error'] = 'File is too big'\n elif not ACCEPT_FILE_TYPES.match(file['type']):\n file['error'] = 'Filetype not allowed'\n else:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L51_C12", "label": "assign", "type": "assigned_variable", "loc": [51, 51], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L50_C8", "vector": [14, 4, 0.3091, 0.0061, 4, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " file['error'] = 'File is too big'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L52_C8", "label": "if", "type": "if", "loc": [52, 55], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L50_C8", "vector": [4, 4, 0.3242, 0.0242, 4, 0.14, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not ACCEPT_FILE_TYPES.match(file['type']):\n file['error'] = 'Filetype not allowed'\n else:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L53_C12", "label": "assign", "type": "assigned_variable", "loc": [53, 53], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L52_C8", "vector": [14, 5, 0.3212, 0.0061, 5, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " file['error'] = 'Filetype not allowed'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Return_L55_C12", "label": "return", "type": "return", "loc": [55, 55], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L52_C8", "vector": [13, 5, 0.3333, 0.0061, 5, 0.33, 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_1378:Return_L56_C8", "label": "return", "type": "return", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L47_C4", "vector": [13, 2, 0.3394, 0.0061, 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 False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L58_C4", "label": "get_file_size", "type": "function", "loc": [58, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "vector": [2, 1, 0.3636, 0.0303, 1, 0.83, 0.2222, 852, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "get_file_size", "arg_names": ["self", "file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_file_size(self, file):\n file.seek(0, 2) # Seek to the end of the file\n size = file.tell() # Get the position of EOF\n file.seek(0) # Reset the file position to the beginning\n return size"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L59_C8", "label": "seek()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L58_C4", "vector": [8, 2, 0.3576, 0.0061, 2, 0.2, 0.0, 66, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "seek", "arg_names": [], "import_names": [], "rhs_call_name": "seek", "annotation": ""}, "snippet": " file.seek(0, 2) # Seek to the end of the file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L60_C8", "label": "size = tell()", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L58_C4", "vector": [14, 2, 0.3636, 0.0061, 2, 0.2, 0.3333, 714, 3, 0, 0, 0, 759, 10, 1], "semantic": {"name": "size", "arg_names": [], "import_names": [], "rhs_call_name": "tell", "annotation": ""}, "snippet": " size = file.tell() # Get the position of EOF"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L61_C8", "label": "seek()", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L58_C4", "vector": [8, 2, 0.3697, 0.0061, 2, 0.2, 0.6667, 66, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "seek", "arg_names": [], "import_names": [], "rhs_call_name": "seek", "annotation": ""}, "snippet": " file.seek(0) # Reset the file position to the beginning"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Return_L62_C8", "label": "return", "type": "return", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L58_C4", "vector": [13, 2, 0.3758, 0.0061, 2, 0.2, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return size"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L64_C4", "label": "write_blob", "type": "function", "loc": [64, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "vector": [2, 1, 0.4121, 0.0545, 1, 0.83, 0.3333, 910, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "write_blob", "arg_names": ["self", "data", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def write_blob(self, data, info):\n blob = files.blobstore.create(\n mime_type=info['type'],\n _blobinfo_uploaded_filename=info['name']\n )\n with files.open(blob, 'a') as f:\n f.write(data)\n files.finalize(blob)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L65_C8", "label": "blob = create()", "type": "assigned_variable", "loc": [65, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L64_C4", "vector": [14, 2, 0.403, 0.0242, 2, 0.06, 0.0, 657, 3, 2, 0, 0, 316, 10, 1], "semantic": {"name": "blob", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " blob = files.blobstore.create(\n mime_type=info['type'],\n _blobinfo_uploaded_filename=info['name']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L70_C12", "label": "write()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L64_C4", "vector": [8, 2, 0.4242, 0.0061, 2, 0.06, 0.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L71_C8", "label": "finalize()", "type": "expression", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L64_C4", "vector": [8, 2, 0.4303, 0.0061, 2, 0.06, 0.5, 716, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "finalize", "arg_names": [], "import_names": [], "rhs_call_name": "finalize", "annotation": ""}, "snippet": " files.finalize(blob)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Return_L72_C8", "label": "return", "type": "return", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L64_C4", "vector": [13, 2, 0.4364, 0.0061, 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 files.blobstore.get_blob_key(blob)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L74_C4", "label": "handle_upload", "type": "function", "loc": [74, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "vector": [2, 1, 0.5818, 0.2727, 1, 0.83, 0.4444, 342, 0, 1, 1, 0, 0, 0, 16], "semantic": {"name": "handle_upload", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_upload(self):\n results = []\n blob_keys = []\n for name, fieldStorage in self.request.POST.items():\n if type(fieldStorage) is unicode:\n continue\n result = {}\n result['name'] = re.sub("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L75_C8", "label": "results =", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L74_C4", "vector": [14, 2, 0.4545, 0.0061, 2, 0.47, 0.0, 143, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "results", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " results = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L76_C8", "label": "blob_keys =", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L74_C4", "vector": [14, 2, 0.4606, 0.0061, 2, 0.47, 0.25, 841, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "blob_keys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blob_keys = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:For_L77_C8", "label": "for name, fieldStorage", "type": "for", "loc": [77, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L74_C4", "vector": [6, 2, 0.5727, 0.2182, 2, 0.47, 0.5, 137, 3, 0, 0, 0, 0, 0, 15], "semantic": {"name": "name, fieldStorage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name, fieldStorage in self.request.POST.items():\n if type(fieldStorage) is unicode:\n continue\n result = {}\n result['name'] = re.sub(\n r'^.*\\\\',\n '',\n fieldStorage.filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L78_C12", "label": "if", "type": "if", "loc": [78, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:For_L77_C8", "vector": [4, 3, 0.4758, 0.0121, 3, 0.51, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if type(fieldStorage) is unicode:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L80_C12", "label": "result =", "type": "assigned_variable", "loc": [80, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:For_L77_C8", "vector": [14, 3, 0.4848, 0.0061, 3, 0.51, 0.1667, 51, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L81_C12", "label": " = sub()", "type": "assigned_variable", "loc": [81, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:For_L77_C8", "vector": [14, 3, 0.503, 0.0303, 3, 0.51, 0.3333, 0, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " result['name'] = re.sub(\n r'^.*\\\\',\n '',\n fieldStorage.filename\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L86_C12", "label": "assign", "type": "assigned_variable", "loc": [86, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:For_L77_C8", "vector": [14, 3, 0.5212, 0.0061, 3, 0.51, 0.5, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result['type'] = fieldStorage.type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L87_C12", "label": " = get_file_size()", "type": "assigned_variable", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:For_L77_C8", "vector": [14, 3, 0.5273, 0.0061, 3, 0.51, 0.6667, 0, 3, 1, 0, 0, 852, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get_file_size", "annotation": ""}, "snippet": " result['size'] = self.get_file_size(fieldStorage.file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L88_C12", "label": "if", "type": "if", "loc": [88, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:For_L77_C8", "vector": [4, 3, 0.603, 0.1455, 3, 0.51, 0.8333, 0, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.validate(result):\n blob_key = str(\n self.write_blob(fieldStorage.value, result)\n )\n blob_keys.append(blob_key)\n result['deleteType'] = 'DELETE'\n result['deleteUrl'] = self.request.host_url +\\\n '/?key=' + urllib.quote(blob_key, '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L89_C16", "label": "blob_key = str()", "type": "assigned_variable", "loc": [89, 91], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L88_C12", "vector": [14, 4, 0.5455, 0.0182, 4, 0.06, 0.0, 72, 3, 1, 0, 0, 52, 10, 2], "semantic": {"name": "blob_key", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " blob_key = str(\n self.write_blob(fieldStorage.value, result)\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L92_C16", "label": "append()", "type": "expression", "loc": [92, 92], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L88_C12", "vector": [8, 4, 0.5576, 0.0061, 4, 0.06, 0.2, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " blob_keys.append(blob_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L93_C16", "label": "assign", "type": "assigned_variable", "loc": [93, 93], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L88_C12", "vector": [14, 4, 0.5636, 0.0061, 4, 0.06, 0.4, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result['deleteType'] = 'DELETE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L94_C16", "label": "assign", "type": "assigned_variable", "loc": [94, 95], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L88_C12", "vector": [14, 4, 0.5727, 0.0121, 4, 0.06, 0.6, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result['deleteUrl'] = self.request.host_url +\\\n '/?key=' + urllib.quote(blob_key, '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L96_C16", "label": "if", "type": "if", "loc": [96, 107], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L88_C12", "vector": [4, 4, 0.6152, 0.0727, 4, 0.06, 0.8, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (IMAGE_TYPES.match(result['type'])):\n try:\n result['url'] = images.get_serving_url(\n blob_key,\n secure_url=self.request.host_url.startswith(\n 'https'\n )\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Try_L97_C20", "label": "try", "type": "try", "loc": [97, 107], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L96_C16", "vector": [7, 5, 0.6182, 0.0667, 5, 0.92, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n result['url'] = images.get_serving_url(\n blob_key,\n secure_url=self.request.host_url.startswith(\n 'https'\n )\n )\n result['thumbnailUrl'] = result['url'] +\\"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L98_C24", "label": " = get_serving_url()", "type": "assigned_variable", "loc": [98, 103], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:Try_L97_C20", "vector": [14, 6, 0.6091, 0.0364, 6, 0.56, 0.0, 0, 3, 2, 0, 0, 824, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get_serving_url", "annotation": ""}, "snippet": " result['url'] = images.get_serving_url(\n blob_key,\n secure_url=self.request.host_url.startswith(\n 'https'\n )\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L104_C24", "label": "assign", "type": "assigned_variable", "loc": [104, 105], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:Try_L97_C20", "vector": [14, 6, 0.6333, 0.0121, 6, 0.56, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result['thumbnailUrl'] = result['url'] +\\\n THUMBNAIL_MODIFICATOR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L108_C16", "label": "if", "type": "if", "loc": [108, 111], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L88_C12", "vector": [4, 4, 0.6636, 0.0242, 4, 0.06, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not 'url' in result:\n result['url'] = self.request.host_url +\\\n '/' + blob_key + '/' + urllib.quote(\n result['name'].encode('utf-8'), '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L109_C20", "label": "assign", "type": "assigned_variable", "loc": [109, 111], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L108_C16", "vector": [14, 5, 0.6667, 0.0182, 5, 0.72, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result['url'] = self.request.host_url +\\\n '/' + blob_key + '/' + urllib.quote(\n result['name'].encode('utf-8'), '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L112_C12", "label": "append()", "type": "expression", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:For_L77_C8", "vector": [8, 3, 0.6788, 0.0061, 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": " results.append(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L113_C8", "label": "defer()", "type": "expression", "loc": [113, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L74_C4", "vector": [8, 2, 0.697, 0.0303, 2, 0.47, 0.75, 826, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "defer", "arg_names": [], "import_names": [], "rhs_call_name": "defer", "annotation": ""}, "snippet": " deferred.defer(\n cleanup,\n blob_keys,\n _countdown=EXPIRATION_TIME\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Return_L118_C8", "label": "return", "type": "return", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L74_C4", "vector": [13, 2, 0.7152, 0.0061, 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 results"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L120_C4", "label": "options", "type": "function", "loc": [120, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "vector": [2, 1, 0.7303, 0.0121, 1, 0.83, 0.5556, 707, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "options", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def options(self):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L123_C4", "label": "head", "type": "function", "loc": [123, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "vector": [2, 1, 0.7485, 0.0121, 1, 0.83, 0.6667, 217, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "head", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def head(self):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L126_C4", "label": "get", "type": "function", "loc": [126, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "vector": [2, 1, 0.7667, 0.0121, 1, 0.83, 0.7778, 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(WEBSITE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L127_C8", "label": "redirect()", "type": "expression", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L126_C4", "vector": [8, 2, 0.7697, 0.0061, 2, 0.36, 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(WEBSITE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L129_C4", "label": "post", "type": "function", "loc": [129, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "vector": [2, 1, 0.8182, 0.0788, 1, 0.83, 0.8889, 304, 0, 1, 1, 0, 0, 0, 11], "semantic": {"name": "post", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def post(self):\n if (self.request.get('_method') == 'DELETE'):\n return self.delete()\n result = {'files': self.handle_upload()}\n s = json.dumps(result, separators=(',', ':'))\n redirect = self.request.get('redirect')\n if redirect:\n return self.redirect(str("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L130_C8", "label": "if", "type": "if", "loc": [130, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L129_C4", "vector": [4, 2, 0.7909, 0.0121, 2, 0.17, 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('_method') == 'DELETE'):\n return self.delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Return_L131_C12", "label": "return", "type": "return", "loc": [131, 131], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L130_C8", "vector": [13, 3, 0.7939, 0.0061, 3, 0.2, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L132_C8", "label": "result =", "type": "assigned_variable", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L129_C4", "vector": [14, 2, 0.8, 0.0061, 2, 0.17, 0.1667, 51, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result = {'files': self.handle_upload()}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L133_C8", "label": "s = dumps()", "type": "assigned_variable", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L129_C4", "vector": [14, 2, 0.8061, 0.0061, 2, 0.17, 0.3333, 553, 3, 2, 0, 0, 160, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "dumps", "annotation": ""}, "snippet": " s = json.dumps(result, separators=(',', ':'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L134_C8", "label": "redirect = get()", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L129_C4", "vector": [14, 2, 0.8121, 0.0061, 2, 0.17, 0.5, 206, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " redirect = self.request.get('redirect')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L135_C8", "label": "if", "type": "if", "loc": [135, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L129_C4", "vector": [4, 2, 0.8273, 0.0242, 2, 0.17, 0.6667, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if redirect:\n return self.redirect(str(\n redirect.replace('%s', urllib.quote(s, ''), 1)\n ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Return_L136_C12", "label": "return", "type": "return", "loc": [136, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L135_C8", "vector": [13, 3, 0.8303, 0.0182, 3, 0.86, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.redirect(str(\n redirect.replace('%s', urllib.quote(s, ''), 1)\n ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L139_C8", "label": "if", "type": "if", "loc": [139, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L129_C4", "vector": [4, 2, 0.8455, 0.0121, 2, 0.17, 0.8333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'application/json' in self.request.headers.get('Accept'):\n self.response.headers['Content-Type'] = 'application/json'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L140_C12", "label": "assign", "type": "assigned_variable", "loc": [140, 140], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L139_C8", "vector": [14, 3, 0.8485, 0.0061, 3, 0.86, 0.0, 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'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L141_C8", "label": "write()", "type": "expression", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L129_C4", "vector": [8, 2, 0.8545, 0.0061, 2, 0.17, 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.write(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L143_C4", "label": "delete", "type": "function", "loc": [143, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "vector": [2, 1, 0.8697, 0.0121, 1, 0.83, 1.0, 266, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def delete(self):\n blobstore.delete(self.request.get('key') or '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L144_C8", "label": "delete()", "type": "expression", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L143_C4", "vector": [8, 2, 0.8727, 0.0061, 2, 0.54, 0.0, 266, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " blobstore.delete(self.request.get('key') or '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L147_C0", "label": "DownloadHandler", "type": "class", "loc": [147, 157], "level": 0, "parent": null, "vector": [3, 0, 0.9212, 0.0667, 0, 0.66, 0.9444, 274, 0, 1, 0, 0, 488, 0, 3], "semantic": {"name": "DownloadHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DownloadHandler(blobstore_handlers.BlobstoreDownloadHandler):\n def get(self, key, filename):\n if not blobstore.get(key):\n self.error(404)\n else:\n # Prevent browsers from MIME-sniffing the content-type:\n self.response.headers['X-Content-Type-Options'] = 'nosniff'\n # Cache for the expiration time:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L148_C4", "label": "get", "type": "function", "loc": [148, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L147_C0", "vector": [2, 1, 0.9242, 0.0606, 1, 0.35, 0.0, 607, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "get", "arg_names": ["self", "key", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self, key, filename):\n if not blobstore.get(key):\n self.error(404)\n else:\n # Prevent browsers from MIME-sniffing the content-type:\n self.response.headers['X-Content-Type-Options'] = 'nosniff'\n # Cache for the expiration time:\n self.response.headers['Cache-Control'] = 'public,max-age=%d' % EXPIRATION_TIME"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L149_C8", "label": "if", "type": "if", "loc": [149, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L148_C4", "vector": [4, 2, 0.9273, 0.0545, 2, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not blobstore.get(key):\n self.error(404)\n else:\n # Prevent browsers from MIME-sniffing the content-type:\n self.response.headers['X-Content-Type-Options'] = 'nosniff'\n # Cache for the expiration time:\n self.response.headers['Cache-Control'] = 'public,max-age=%d' % EXPIRATION_TIME\n # Send the file forcing a download dialog:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L150_C12", "label": "error()", "type": "expression", "loc": [150, 150], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L149_C8", "vector": [8, 3, 0.9091, 0.0061, 3, 0.75, 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_1378:Assign_L153_C12", "label": "assign", "type": "assigned_variable", "loc": [153, 153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L149_C8", "vector": [14, 3, 0.9273, 0.0061, 3, 0.75, 0.3333, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.response.headers['X-Content-Type-Options'] = 'nosniff'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L155_C12", "label": "assign", "type": "assigned_variable", "loc": [155, 155], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L149_C8", "vector": [14, 3, 0.9394, 0.0061, 3, 0.75, 0.6667, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.response.headers['Cache-Control'] = 'public,max-age=%d' % EXPIRATION_TIME"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L157_C12", "label": "send_blob()", "type": "expression", "loc": [157, 157], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L149_C8", "vector": [8, 3, 0.9515, 0.0061, 3, 0.75, 1.0, 403, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "send_blob", "arg_names": [], "import_names": [], "rhs_call_name": "send_blob", "annotation": ""}, "snippet": " self.send_blob(key, save_as=filename, content_type='application/octet-stream')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L159_C0", "label": "app = WSGIApplication()", "type": "assigned_variable", "loc": [159, 165], "level": 0, "parent": null, "vector": [14, 0, 0.9818, 0.0424, 0, 0.66, 1.0, 494, 3, 2, 0, 0, 623, 10, 1], "semantic": {"name": "app", "arg_names": [], "import_names": [], "rhs_call_name": "WSGIApplication", "annotation": ""}, "snippet": "app = webapp2.WSGIApplication(\n [\n ('/', UploadHandler),\n ('/([^/]+)/([^/]+)', DownloadHandler)\n ],\n debug=True\n)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L48_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L48_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Return_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Return_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Return_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Return_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:For_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:For_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:For_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L80_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:For_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L81_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:For_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L86_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:For_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L87_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:For_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L88_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L88_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L89_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L88_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L92_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L88_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L93_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L88_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L94_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L88_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L96_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L96_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Try_L97_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:Try_L97_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L98_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:Try_L97_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L104_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L88_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L108_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L108_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L109_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:For_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L112_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Return_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L130_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Return_L131_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L135_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Return_L136_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L139_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L140_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L143_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:ClassDef_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:FunctionDef_L148_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L150_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Assign_L155_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1378:If_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1378:Expr_L157_C12"}] |
import socket
port = 54321
#host = "137.138.196.188"
host="0.0.0.0"
UDPsock=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# Accepte les datagrammes UDP sur le port depuis tous les expediteurs
UDPsock.bind((host, port))
#UDPsock.connect(('137.138.196.188',port))
print "Ecoute sur port", port
while 1:
data, addr = UDPsock.recvfrom(128)
# print "Recu:", data , "de", addr
# print "Recu:", data
if not data:
print "Client has exited!"
break
else:
print "\nReceived message '", data,"' from ", addr
| ajibawa-2023/Python-Code-Large/train/row_1379 | 11 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1379:Import_L1_C0", "label": "socket import socket", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0556, 0, 0.66, 0.0, 687, 0, 1, 0, 0, 687, 0, 0], "semantic": {"name": "socket", "arg_names": [], "import_names": ["socket"], "rhs_call_name": "", "annotation": ""}, "snippet": "import socket"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1379:Assign_L2_C0", "label": "port =", "type": "assigned_variable", "loc": [2, 2], "level": 0, "parent": null, "vector": [14, 0, 0.1111, 0.0556, 0, 0.66, 0.1667, 308, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "port", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "port = 54321"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1379:Assign_L4_C0", "label": "host =", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.2222, 0.0556, 0, 0.66, 0.3333, 867, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "host=\"0.0.0.0\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1379:Assign_L5_C0", "label": "UDPsock = socket()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.2778, 0.0556, 0, 0.66, 0.5, 845, 3, 2, 0, 0, 687, 10, 1], "semantic": {"name": "UDPsock", "arg_names": [], "import_names": [], "rhs_call_name": "socket", "annotation": ""}, "snippet": "UDPsock=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1379:Expr_L7_C0", "label": "bind()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.3889, 0.0556, 0, 0.66, 0.6667, 640, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "bind", "arg_names": [], "import_names": [], "rhs_call_name": "bind", "annotation": ""}, "snippet": "UDPsock.bind((host, port))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1379:Expr_L9_C0", "label": "print()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.5, 0.0556, 0, 0.66, 0.8333, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"Ecoute sur port\", port)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1379:While_L10_C0", "label": "while", "type": "while", "loc": [10, 18], "level": 0, "parent": null, "vector": [5, 0, 0.7778, 0.5, 0, 0.66, 1.0, 0, 1, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "while 1:\n data, addr = UDPsock.recvfrom(128)\n# print \"Recu:\", data , \"de\", addr\n# print \"Recu:\", data \n if not data:\n print(\"Client has exited!\")\n break\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1379:Assign_L11_C4", "label": "data, addr = recvfrom()", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1379:While_L10_C0", "vector": [14, 1, 0.6111, 0.0556, 1, 0.87, 0.0, 265, 3, 1, 0, 0, 878, 10, 1], "semantic": {"name": "data, addr", "arg_names": [], "import_names": [], "rhs_call_name": "recvfrom", "annotation": ""}, "snippet": " data, addr = UDPsock.recvfrom(128)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1379:If_L14_C4", "label": "if", "type": "if", "loc": [14, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1379:While_L10_C0", "vector": [4, 1, 0.8889, 0.2778, 1, 0.87, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not data:\n print(\"Client has exited!\")\n break\n else:\n print(\"\\nReceived message '\", data,\"' from \", addr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1379:Expr_L15_C8", "label": "print()", "type": "expression", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1379:If_L14_C4", "vector": [8, 2, 0.8333, 0.0556, 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(\"Client has exited!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1379:Expr_L18_C8", "label": "print()", "type": "expression", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1379:If_L14_C4", "vector": [8, 2, 1.0, 0.0556, 2, 0.71, 1.0, 535, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\nReceived message '\", data,\"' from \", addr)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1379:While_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1379:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1379:While_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1379:If_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1379:If_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1379:Expr_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1379:If_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1379:Expr_L18_C8"}] |
import socket,time
port = 54321
#host = "localhost"
host = "192.168.0.9"
#host = "137.138.196.188"
#host="128.141.140.144"
UDPsock=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
#s.bind(("", port))
while ( 1 ):
commande = raw_input("Commande? ")
UDPsock.sendto(commande,(host, port))
print "envoie commande[",commande,"]" | ajibawa-2023/Python-Code-Large/train/row_1380 | 8 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1380:Import_L1_C0", "label": "socket import socket, time", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 687, 0, 2, 0, 0, 687, 0, 0], "semantic": {"name": "socket", "arg_names": [], "import_names": ["socket", "time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import socket,time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1380:Assign_L2_C0", "label": "port =", "type": "assigned_variable", "loc": [2, 2], "level": 0, "parent": null, "vector": [14, 0, 0.1667, 0.0833, 0, 0.66, 0.25, 308, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "port", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "port = 54321"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1380:Assign_L4_C0", "label": "host =", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.3333, 0.0833, 0, 0.66, 0.5, 867, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "host = \"192.168.0.9\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1380:Assign_L7_C0", "label": "UDPsock = socket()", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.5833, 0.0833, 0, 0.66, 0.75, 845, 3, 2, 0, 0, 687, 10, 1], "semantic": {"name": "UDPsock", "arg_names": [], "import_names": [], "rhs_call_name": "socket", "annotation": ""}, "snippet": "UDPsock=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1380:While_L9_C0", "label": "while", "type": "while", "loc": [9, 12], "level": 0, "parent": null, "vector": [5, 0, 0.875, 0.3333, 0, 0.66, 1.0, 0, 1, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "while ( 1 ):\n commande = raw_input(\"Commande? \")\n UDPsock.sendto(commande,(host, port))\n print(\"envoie commande[\",commande,\"]\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1380:Assign_L10_C4", "label": "commande = raw_input()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1380:While_L9_C0", "vector": [14, 1, 0.8333, 0.0833, 1, 0.34, 0.0, 953, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "commande", "arg_names": [], "import_names": [], "rhs_call_name": "raw_input", "annotation": ""}, "snippet": " commande = raw_input(\"Commande? \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1380:Expr_L11_C4", "label": "sendto()", "type": "expression", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1380:While_L9_C0", "vector": [8, 1, 0.9167, 0.0833, 1, 0.34, 0.5, 765, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "sendto", "arg_names": [], "import_names": [], "rhs_call_name": "sendto", "annotation": ""}, "snippet": " UDPsock.sendto(commande,(host, port))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1380:Expr_L12_C4", "label": "print()", "type": "expression", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1380:While_L9_C0", "vector": [8, 1, 1.0, 0.0833, 1, 0.34, 1.0, 535, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"envoie commande[\",commande,\"]\")"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1380:While_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1380:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1380:While_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1380:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1380:While_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1380:Expr_L12_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_1381 | 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_1381: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_1381: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_1381: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_1381: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_1381: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_1381:Expr_L13_C2", "label": "expression", "type": "expression", "loc": [13, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L12_C0", "vector": [8, 1, 0.1596, 0.0532, 1, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n 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_1381:Assign_L18_C2", "label": "process = Popen()", "type": "assigned_variable", "loc": [18, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L12_C0", "vector": [14, 1, 0.2074, 0.0426, 1, 0.1, 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_1381:Assign_L22_C2", "label": "output =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L12_C0", "vector": [14, 1, 0.234, 0.0106, 1, 0.1, 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_1381:Return_L23_C2", "label": "return", "type": "return", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L12_C0", "vector": [13, 1, 0.2447, 0.0106, 1, 0.1, 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_1381: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_1381:Expr_L27_C2", "label": "expression", "type": "expression", "loc": [27, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L26_C0", "vector": [8, 1, 0.3191, 0.0745, 1, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n 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_1381:Assign_L35_C2", "label": "output_lines = _GetOutputLines()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L26_C0", "vector": [14, 1, 0.3723, 0.0106, 1, 0.59, 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_1381:Assign_L38_C2", "label": "line_revs =", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L26_C0", "vector": [14, 1, 0.4043, 0.0106, 1, 0.59, 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_1381:For_L39_C2", "label": "for line", "type": "for", "loc": [39, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L26_C0", "vector": [6, 1, 0.4415, 0.0638, 1, 0.59, 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_1381:Assign_L40_C4", "label": "rev_match = match()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L39_C2", "vector": [14, 2, 0.4255, 0.0106, 2, 0.01, 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_1381:If_L41_C4", "label": "if", "type": "if", "loc": [41, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L39_C2", "vector": [4, 2, 0.4415, 0.0213, 2, 0.01, 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_1381:Assign_L43_C4", "label": "rev_hash = group()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L39_C2", "vector": [14, 2, 0.4574, 0.0106, 2, 0.01, 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_1381:Expr_L44_C4", "label": "append()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L39_C2", "vector": [8, 2, 0.4681, 0.0106, 2, 0.01, 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_1381:For_L46_C2", "label": "for str", "type": "for", "loc": [46, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L26_C0", "vector": [6, 1, 0.5745, 0.1809, 1, 0.59, 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_1381:Assign_L48_C4", "label": "start_line =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L46_C2", "vector": [14, 2, 0.5106, 0.0106, 2, 0.14, 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_1381:Assign_L49_C4", "label": "end_line =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L46_C2", "vector": [14, 2, 0.5213, 0.0106, 2, 0.14, 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_1381:Assign_L52_C4", "label": "revs =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L46_C2", "vector": [14, 2, 0.5532, 0.0106, 2, 0.14, 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_1381:For_L53_C4", "label": "for line_number", "type": "for", "loc": [53, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L46_C2", "vector": [6, 2, 0.5691, 0.0213, 2, 0.14, 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_1381:Expr_L54_C6", "label": "append()", "type": "expression", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L53_C4", "vector": [8, 3, 0.5745, 0.0106, 3, 0.12, 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_1381:If_L58_C4", "label": "if", "type": "if", "loc": [58, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L46_C2", "vector": [4, 2, 0.6223, 0.0213, 2, 0.14, 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_1381:Assign_L62_C4", "label": " = frozenset()", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L46_C2", "vector": [14, 2, 0.6596, 0.0106, 2, 0.14, 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_1381: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_1381:Expr_L65_C2", "label": "expression", "type": "expression", "loc": [65, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L64_C0", "vector": [8, 1, 0.7394, 0.1064, 1, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n 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_1381:If_L75_C2", "label": "if", "type": "if", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L64_C0", "vector": [4, 1, 0.8032, 0.0213, 1, 0.55, 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_1381:Return_L76_C4", "label": "return", "type": "return", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:If_L75_C2", "vector": [13, 2, 0.8085, 0.0106, 2, 0.95, 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_1381:Assign_L79_C2", "label": "args =", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L64_C0", "vector": [14, 1, 0.8404, 0.0106, 1, 0.55, 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_1381:Assign_L80_C2", "label": "output_lines = _GetOutputLines()", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L64_C0", "vector": [14, 1, 0.8511, 0.0106, 1, 0.55, 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_1381:Return_L82_C2", "label": "return", "type": "return", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L64_C0", "vector": [13, 1, 0.8723, 0.0106, 1, 0.55, 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_1381: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_1381:Expr_L85_C2", "label": "expression", "type": "expression", "loc": [85, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L84_C0", "vector": [8, 1, 0.9362, 0.0745, 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 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_1381:If_L92_C2", "label": "if", "type": "if", "loc": [92, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L84_C0", "vector": [4, 1, 0.984, 0.0213, 1, 0.58, 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_1381:Return_L93_C4", "label": "return", "type": "return", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:If_L92_C2", "vector": [13, 2, 0.9894, 0.0106, 2, 0.01, 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_1381:Return_L94_C2", "label": "return", "type": "return", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L84_C0", "vector": [13, 1, 1.0, 0.0106, 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 rev2"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Expr_L13_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Assign_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Return_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Expr_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Assign_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:If_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Expr_L54_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:If_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Expr_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:If_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:If_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Return_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Assign_L79_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Assign_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Return_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Expr_L85_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:If_L92_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:If_L92_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1381:Return_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1381:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1381: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_1382 | 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_1382: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_1382: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_1382: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_1382: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_1382: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_1382: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_1382:Expr_L14_C2", "label": "print()", "type": "expression", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L13_C0", "vector": [8, 1, 0.1458, 0.0104, 1, 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('Usage: %s <command> [<language> ...]\\n' % sys.argv[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1382:Expr_L15_C2", "label": "print()", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L13_C0", "vector": [8, 1, 0.1562, 0.0104, 1, 0.96, 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_1382:Expr_L16_C2", "label": "print()", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L13_C0", "vector": [8, 1, 0.1667, 0.0104, 1, 0.96, 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_1382:Expr_L17_C2", "label": "print()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L13_C0", "vector": [8, 1, 0.1771, 0.0104, 1, 0.96, 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_1382:Expr_L18_C2", "label": "print()", "type": "expression", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L13_C0", "vector": [8, 1, 0.1875, 0.0104, 1, 0.96, 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_1382:Expr_L19_C2", "label": "exit()", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L13_C0", "vector": [8, 1, 0.1979, 0.0104, 1, 0.96, 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_1382: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_1382:Expr_L23_C2", "label": "expression", "type": "expression", "loc": [23, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L22_C0", "vector": [8, 1, 0.2656, 0.0625, 1, 0.12, 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_1382:Assign_L29_C2", "label": "validator = Validator()", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L22_C0", "vector": [14, 1, 0.3021, 0.0104, 1, 0.12, 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_1382:Expr_L30_C2", "label": "Validate()", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L22_C0", "vector": [8, 1, 0.3125, 0.0104, 1, 0.12, 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_1382:Assign_L31_C2", "label": "missing = missing_in_lang()", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L22_C0", "vector": [14, 1, 0.3229, 0.0104, 1, 0.12, 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_1382:Assign_L32_C2", "label": "outdated = outdated_in_lang()", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L22_C0", "vector": [14, 1, 0.3333, 0.0104, 1, 0.12, 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_1382:For_L34_C2", "label": "for lang", "type": "for", "loc": [34, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L22_C0", "vector": [6, 1, 0.3906, 0.0833, 1, 0.12, 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_1382:Assign_L35_C4", "label": "untranslated =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L34_C2", "vector": [14, 2, 0.3646, 0.0104, 2, 0.39, 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_1382:If_L37_C4", "label": "if", "type": "if", "loc": [37, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L34_C2", "vector": [4, 2, 0.3906, 0.0208, 2, 0.39, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(untranslated) == 0:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1382:Assign_L40_C4", "label": "translator = Translator()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L34_C2", "vector": [14, 2, 0.4167, 0.0104, 2, 0.39, 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_1382:Expr_L41_C4", "label": "Translate()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L34_C2", "vector": [8, 2, 0.4271, 0.0104, 2, 0.39, 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_1382: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_1382:Expr_L45_C2", "label": "expression", "type": "expression", "loc": [45, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L44_C0", "vector": [8, 1, 0.4896, 0.0521, 1, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n 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_1382:Assign_L50_C2", "label": "validator = Validator()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L44_C0", "vector": [14, 1, 0.5208, 0.0104, 1, 0.18, 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_1382:Expr_L51_C2", "label": "Validate()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L44_C0", "vector": [8, 1, 0.5312, 0.0104, 1, 0.18, 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_1382:Assign_L53_C2", "label": "error_count =", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L44_C0", "vector": [14, 1, 0.5521, 0.0104, 1, 0.18, 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_1382:If_L54_C2", "label": "if", "type": "if", "loc": [54, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L44_C0", "vector": [4, 1, 0.6198, 0.125, 1, 0.18, 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_1382:Expr_L55_C4", "label": "print()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L54_C2", "vector": [8, 2, 0.5729, 0.0104, 2, 0.49, 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_1382:For_L57_C4", "label": "for lang, missing", "type": "for", "loc": [57, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L54_C2", "vector": [6, 2, 0.6042, 0.0312, 2, 0.49, 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_1382:Expr_L58_C6", "label": "print()", "type": "expression", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L57_C4", "vector": [8, 3, 0.6042, 0.0104, 3, 0.02, 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_1382:Assign_L59_C6", "label": "error_count =", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L57_C4", "vector": [14, 3, 0.6146, 0.0104, 3, 0.02, 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_1382:For_L60_C4", "label": "for lang, missing", "type": "for", "loc": [60, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L54_C2", "vector": [6, 2, 0.6354, 0.0312, 2, 0.49, 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_1382:Expr_L61_C6", "label": "print()", "type": "expression", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L60_C4", "vector": [8, 3, 0.6354, 0.0104, 3, 0.39, 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_1382:Assign_L62_C6", "label": "error_count =", "type": "assigned_variable", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L60_C4", "vector": [14, 3, 0.6458, 0.0104, 3, 0.39, 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_1382:For_L63_C4", "label": "for lang, outdated", "type": "for", "loc": [63, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L54_C2", "vector": [6, 2, 0.6667, 0.0312, 2, 0.49, 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_1382:Expr_L64_C6", "label": "print()", "type": "expression", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L63_C4", "vector": [8, 3, 0.6667, 0.0104, 3, 0.76, 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_1382:Assign_L65_C6", "label": "error_count =", "type": "assigned_variable", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L63_C4", "vector": [14, 3, 0.6771, 0.0104, 3, 0.76, 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_1382:Return_L67_C2", "label": "return", "type": "return", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L44_C0", "vector": [13, 1, 0.6979, 0.0104, 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 error_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1382: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_1382:Assign_L71_C2", "label": "argv =", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L70_C0", "vector": [14, 1, 0.7396, 0.0104, 1, 0.29, 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_1382:Assign_L72_C2", "label": "argc = len()", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L70_C0", "vector": [14, 1, 0.75, 0.0104, 1, 0.29, 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_1382:If_L73_C2", "label": "if", "type": "if", "loc": [73, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L70_C0", "vector": [4, 1, 0.7656, 0.0208, 1, 0.29, 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_1382:Expr_L74_C4", "label": "Usage()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L73_C2", "vector": [8, 2, 0.7708, 0.0104, 2, 0.25, 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_1382:Assign_L76_C2", "label": "languages = GetAllLanguageFiles()", "type": "assigned_variable", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L70_C0", "vector": [14, 1, 0.7917, 0.0104, 1, 0.29, 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_1382:If_L77_C2", "label": "if", "type": "if", "loc": [77, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L70_C0", "vector": [4, 1, 0.8438, 0.0938, 1, 0.29, 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_1382:Assign_L78_C4", "label": "langs = set()", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L77_C2", "vector": [14, 2, 0.8125, 0.0104, 2, 0.59, 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_1382:If_L79_C4", "label": "if", "type": "if", "loc": [79, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L77_C2", "vector": [4, 2, 0.8281, 0.0208, 2, 0.59, 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_1382:Assign_L83_C4", "label": "languages = dict()", "type": "assigned_variable", "loc": [83, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L77_C2", "vector": [14, 2, 0.875, 0.0312, 2, 0.59, 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_1382:Assign_L87_C2", "label": "cmd =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L70_C0", "vector": [14, 1, 0.9062, 0.0104, 1, 0.29, 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_1382:If_L88_C2", "label": "if", "type": "if", "loc": [88, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L70_C0", "vector": [4, 1, 0.9479, 0.0729, 1, 0.29, 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_1382:Expr_L89_C4", "label": "Translate()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L88_C2", "vector": [8, 2, 0.9271, 0.0104, 2, 0.27, 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_1382:If_L90_C2", "label": "if", "type": "if", "loc": [90, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L88_C2", "vector": [4, 2, 0.9583, 0.0521, 2, 0.27, 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_1382:Assign_L91_C4", "label": "error_count = Validate()", "type": "assigned_variable", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L90_C2", "vector": [14, 3, 0.9479, 0.0104, 3, 0.95, 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_1382:Expr_L93_C4", "label": "Usage()", "type": "expression", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L90_C2", "vector": [8, 3, 0.9688, 0.0104, 3, 0.95, 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_1382:Assign_L94_C4", "label": "error_count =", "type": "assigned_variable", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L90_C2", "vector": [14, 3, 0.9792, 0.0104, 3, 0.95, 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_1382:Expr_L96_C2", "label": "print()", "type": "expression", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L70_C0", "vector": [8, 1, 1.0, 0.0104, 1, 0.29, 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_1382:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Expr_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Expr_L15_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Expr_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Expr_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Expr_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Expr_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Expr_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Assign_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Expr_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Assign_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Assign_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Expr_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Assign_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Expr_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Expr_L58_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Assign_L59_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Expr_L61_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Assign_L62_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Expr_L64_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:For_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Assign_L65_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Return_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Assign_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Assign_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L73_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Assign_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Expr_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1382:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1382:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1382: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_1383 | 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_1383: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_1383: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_1383:Expr_L10_C2", "label": "expression", "type": "expression", "loc": [10, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1383:ClassDef_L9_C0", "vector": [8, 1, 0.5238, 0.1429, 1, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n classdocs\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1383:FunctionDef_L14_C2", "label": "__init__", "type": "function", "loc": [14, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1383:ClassDef_L9_C0", "vector": [2, 1, 0.7619, 0.2381, 1, 0.75, 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_1383:Expr_L15_C4", "label": "expression", "type": "expression", "loc": [15, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1383:FunctionDef_L14_C2", "vector": [8, 2, 0.7619, 0.1429, 2, 0.68, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Constructor\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1383:Assign_L18_C4", "label": "self._language =", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1383:FunctionDef_L14_C2", "vector": [14, 2, 0.8571, 0.0476, 2, 0.68, 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_1383:FunctionDef_L20_C2", "label": "Translate", "type": "function", "loc": [20, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1383:ClassDef_L9_C0", "vector": [2, 1, 0.9762, 0.0952, 1, 0.75, 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_1383:Expr_L21_C4", "label": "print()", "type": "expression", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1383:FunctionDef_L20_C2", "vector": [8, 2, 1.0, 0.0476, 2, 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(string_names)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1383:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1383:Expr_L10_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1383:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1383:FunctionDef_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1383:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1383:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1383:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1383:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1383:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1383:FunctionDef_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1383:FunctionDef_L20_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1383: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_1384 | 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_1384: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_1384: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_1384: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_1384: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_1384: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_1384:FunctionDef_L14_C2", "label": "__init__", "type": "function", "loc": [14, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:ClassDef_L12_C0", "vector": [2, 1, 0.2174, 0.2, 1, 0.69, 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_1384:Expr_L15_C4", "label": "expression", "type": "expression", "loc": [15, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L14_C2", "vector": [8, 2, 0.1522, 0.0522, 2, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n 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_1384:Assign_L21_C4", "label": "self._langs =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L14_C2", "vector": [14, 2, 0.1826, 0.0087, 2, 0.41, 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_1384:Assign_L22_C4", "label": "self._master =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L14_C2", "vector": [14, 2, 0.1913, 0.0087, 2, 0.41, 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_1384:Assign_L23_C4", "label": "self._language_paths =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L14_C2", "vector": [14, 2, 0.2, 0.0087, 2, 0.41, 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_1384:Assign_L25_C4", "label": "parser = StringsParser()", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L14_C2", "vector": [14, 2, 0.2174, 0.0087, 2, 0.41, 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_1384:For_L26_C4", "label": "for lang, lang_dir", "type": "for", "loc": [26, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L14_C2", "vector": [6, 2, 0.2609, 0.0783, 2, 0.41, 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_1384:Assign_L27_C6", "label": "filename = join()", "type": "assigned_variable", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L26_C4", "vector": [14, 3, 0.2348, 0.0087, 3, 0.8, 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_1384:Assign_L28_C6", "label": "parsed_file = Parse()", "type": "assigned_variable", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L26_C4", "vector": [14, 3, 0.2435, 0.0087, 3, 0.8, 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_1384:Expr_L29_C6", "label": "FillMercurialRevisions()", "type": "expression", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L26_C4", "vector": [8, 3, 0.2522, 0.0087, 3, 0.8, 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_1384:If_L31_C6", "label": "if", "type": "if", "loc": [31, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L26_C4", "vector": [4, 3, 0.2826, 0.0348, 3, 0.8, 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_1384:Assign_L32_C8", "label": "self._master =", "type": "assigned_variable", "loc": [32, 32], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L31_C6", "vector": [14, 4, 0.2783, 0.0087, 4, 0.71, 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_1384:Assign_L34_C8", "label": "assign", "type": "assigned_variable", "loc": [34, 34], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L31_C6", "vector": [14, 4, 0.2957, 0.0087, 4, 0.71, 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_1384:Expr_L36_C4", "label": "_Reset()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L14_C2", "vector": [8, 2, 0.313, 0.0087, 2, 0.41, 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_1384:FunctionDef_L38_C2", "label": "Validate", "type": "function", "loc": [38, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:ClassDef_L12_C0", "vector": [2, 1, 0.3565, 0.0609, 1, 0.69, 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_1384:Expr_L39_C4", "label": "expression", "type": "expression", "loc": [39, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L38_C2", "vector": [8, 2, 0.3478, 0.0261, 2, 0.77, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Computes whether all the data in the files for the given languages is valid.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1384:Expr_L42_C4", "label": "_Reset()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L38_C2", "vector": [8, 2, 0.3652, 0.0087, 2, 0.77, 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_1384:Expr_L43_C4", "label": "_ValidateMissingKeys()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L38_C2", "vector": [8, 2, 0.3739, 0.0087, 2, 0.77, 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_1384:Expr_L44_C4", "label": "_ValidateOutdatedKeys()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L38_C2", "vector": [8, 2, 0.3826, 0.0087, 2, 0.77, 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_1384:FunctionDef_L46_C2", "label": "valid", "type": "function", "loc": [46, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:ClassDef_L12_C0", "vector": [2, 1, 0.413, 0.0348, 1, 0.69, 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_1384:Return_L47_C4", "label": "return", "type": "return", "loc": [47, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L46_C2", "vector": [13, 2, 0.4174, 0.0261, 2, 0.87, 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_1384:FunctionDef_L51_C2", "label": "missing_in_master", "type": "function", "loc": [51, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:ClassDef_L12_C0", "vector": [2, 1, 0.4478, 0.0174, 1, 0.69, 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_1384:Return_L52_C4", "label": "return", "type": "return", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L51_C2", "vector": [13, 2, 0.4522, 0.0087, 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._missing_in_master"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L54_C2", "label": "missing_in_lang", "type": "function", "loc": [54, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:ClassDef_L12_C0", "vector": [2, 1, 0.4739, 0.0174, 1, 0.69, 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_1384:Return_L55_C4", "label": "return", "type": "return", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L54_C2", "vector": [13, 2, 0.4783, 0.0087, 2, 0.42, 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_1384:FunctionDef_L57_C2", "label": "outdated_in_lang", "type": "function", "loc": [57, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:ClassDef_L12_C0", "vector": [2, 1, 0.5, 0.0174, 1, 0.69, 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_1384:Return_L58_C4", "label": "return", "type": "return", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L57_C2", "vector": [13, 2, 0.5043, 0.0087, 2, 0.55, 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_1384:FunctionDef_L60_C2", "label": "_Reset", "type": "function", "loc": [60, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:ClassDef_L12_C0", "vector": [2, 1, 0.5391, 0.0435, 1, 0.69, 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_1384:Assign_L62_C4", "label": "self._missing_in_master =", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L60_C2", "vector": [14, 2, 0.5391, 0.0087, 2, 0.39, 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_1384:Assign_L63_C4", "label": "self._missing_in_lang =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L60_C2", "vector": [14, 2, 0.5478, 0.0087, 2, 0.39, 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_1384:Assign_L64_C4", "label": "self._outdated_in_lang =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L60_C2", "vector": [14, 2, 0.5565, 0.0087, 2, 0.39, 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_1384:FunctionDef_L66_C2", "label": "_ValidateMissingKeys", "type": "function", "loc": [66, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:ClassDef_L12_C0", "vector": [2, 1, 0.6304, 0.1217, 1, 0.69, 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_1384:Expr_L67_C4", "label": "expression", "type": "expression", "loc": [67, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L66_C2", "vector": [8, 2, 0.5913, 0.0261, 2, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Computes whether there are missing keys on either side.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L70_C4", "label": "master_keys = frozenset()", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L66_C2", "vector": [14, 2, 0.6087, 0.0087, 2, 0.26, 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_1384:For_L71_C4", "label": "for lang, file", "type": "for", "loc": [71, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L66_C2", "vector": [6, 2, 0.6522, 0.0783, 2, 0.26, 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_1384:Assign_L72_C6", "label": "keys = frozenset()", "type": "assigned_variable", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L71_C4", "vector": [14, 3, 0.6261, 0.0087, 3, 0.49, 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_1384:Assign_L73_C6", "label": "missing_in_master =", "type": "assigned_variable", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L71_C4", "vector": [14, 3, 0.6348, 0.0087, 3, 0.49, 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_1384:Assign_L74_C6", "label": "missing_in_lang =", "type": "assigned_variable", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L71_C4", "vector": [14, 3, 0.6435, 0.0087, 3, 0.49, 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_1384:If_L76_C6", "label": "if", "type": "if", "loc": [76, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L71_C4", "vector": [4, 3, 0.6652, 0.0174, 3, 0.49, 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_1384:Assign_L77_C8", "label": "assign", "type": "assigned_variable", "loc": [77, 77], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L76_C6", "vector": [14, 4, 0.6696, 0.0087, 4, 0.79, 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_1384:If_L78_C6", "label": "if", "type": "if", "loc": [78, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L71_C4", "vector": [4, 3, 0.6826, 0.0174, 3, 0.49, 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_1384:Assign_L79_C8", "label": "assign", "type": "assigned_variable", "loc": [79, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L78_C6", "vector": [14, 4, 0.687, 0.0087, 4, 0.31, 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_1384:FunctionDef_L81_C2", "label": "_ValidateOutdatedKeys", "type": "function", "loc": [81, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:ClassDef_L12_C0", "vector": [2, 1, 0.8522, 0.3043, 1, 0.69, 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_1384:Expr_L82_C4", "label": "expression", "type": "expression", "loc": [82, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L81_C2", "vector": [8, 2, 0.7261, 0.0348, 2, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n 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_1384:For_L86_C4", "label": "for lang, file", "type": "for", "loc": [86, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L81_C2", "vector": [6, 2, 0.8739, 0.2609, 2, 0.09, 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_1384:Assign_L87_C6", "label": "outdated =", "type": "assigned_variable", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L86_C4", "vector": [14, 3, 0.7565, 0.0087, 3, 0.19, 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_1384:For_L88_C6", "label": "for key, str", "type": "for", "loc": [88, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L86_C4", "vector": [6, 3, 0.8696, 0.2174, 3, 0.19, 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_1384:Assign_L91_C8", "label": "master_str =", "type": "assigned_variable", "loc": [91, 91], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L88_C6", "vector": [14, 4, 0.7913, 0.0087, 4, 0.92, 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_1384:Assign_L92_C8", "label": "master_revs =", "type": "assigned_variable", "loc": [92, 92], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L88_C6", "vector": [14, 4, 0.8, 0.0087, 4, 0.92, 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_1384:Assign_L93_C8", "label": "lang_revs =", "type": "assigned_variable", "loc": [93, 93], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L88_C6", "vector": [14, 4, 0.8087, 0.0087, 4, 0.92, 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_1384:If_L94_C8", "label": "if", "type": "if", "loc": [94, 96], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L88_C6", "vector": [4, 4, 0.8261, 0.0261, 4, 0.92, 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_1384:Expr_L95_C10", "label": "print()", "type": "expression", "loc": [95, 95], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L94_C8", "vector": [8, 5, 0.8261, 0.0087, 5, 0.19, 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_1384:Assign_L98_C8", "label": "master_file = join()", "type": "assigned_variable", "loc": [98, 98], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L88_C6", "vector": [14, 4, 0.8522, 0.0087, 4, 0.92, 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_1384:Assign_L99_C8", "label": "lang_file = join()", "type": "assigned_variable", "loc": [99, 99], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L88_C6", "vector": [14, 4, 0.8609, 0.0087, 4, 0.92, 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_1384:Assign_L103_C8", "label": "master_rev = reduce()", "type": "assigned_variable", "loc": [103, 105], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L88_C6", "vector": [14, 4, 0.9043, 0.0261, 4, 0.92, 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_1384:Assign_L106_C8", "label": "lang_rev = reduce()", "type": "assigned_variable", "loc": [106, 108], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L88_C6", "vector": [14, 4, 0.9304, 0.0261, 4, 0.92, 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_1384:If_L111_C8", "label": "if", "type": "if", "loc": [111, 112], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L88_C6", "vector": [4, 4, 0.9696, 0.0174, 4, 0.92, 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_1384:Expr_L112_C10", "label": "append()", "type": "expression", "loc": [112, 112], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L111_C8", "vector": [8, 5, 0.9739, 0.0087, 5, 0.82, 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_1384:If_L114_C6", "label": "if", "type": "if", "loc": [114, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L86_C4", "vector": [4, 3, 0.9957, 0.0174, 3, 0.19, 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_1384:Assign_L115_C8", "label": "assign", "type": "assigned_variable", "loc": [115, 115], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L114_C6", "vector": [14, 4, 1.0, 0.0087, 4, 0.78, 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_1384:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L27_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L28_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Expr_L29_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L31_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L31_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L31_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Expr_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Return_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L51_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Return_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Return_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Return_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L72_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L73_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L74_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L76_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L76_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L78_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L78_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L81_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Expr_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:FunctionDef_L81_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L87_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L88_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Expr_L95_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Assign_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:Expr_L112_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:For_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L114_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1384:If_L114_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1384: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_1385 | 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_1385: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_1385: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_1385: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_1385: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_1385: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_1385: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_1385: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_1385: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_1385:Expr_L16_C2", "label": "expression", "type": "expression", "loc": [16, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L15_C0", "vector": [8, 1, 0.3778, 0.0667, 1, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Returns the directory in which the MyTracks directory is located.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1385:Assign_L19_C2", "label": "path = getcwd()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L15_C0", "vector": [14, 1, 0.4222, 0.0222, 1, 0.75, 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_1385:While_L20_C2", "label": "while", "type": "while", "loc": [20, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L15_C0", "vector": [5, 1, 0.5, 0.1333, 1, 0.75, 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_1385:If_L21_C4", "label": "if", "type": "if", "loc": [21, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1385:While_L20_C2", "vector": [4, 2, 0.4778, 0.0444, 2, 0.6, 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_1385:Assign_L25_C4", "label": "path =", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1385:While_L20_C2", "vector": [14, 2, 0.5556, 0.0222, 2, 0.6, 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_1385:Return_L27_C2", "label": "return", "type": "return", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L15_C0", "vector": [13, 1, 0.6, 0.0222, 1, 0.75, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1385: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_1385:Expr_L31_C2", "label": "expression", "type": "expression", "loc": [31, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "vector": [8, 1, 0.7111, 0.0667, 1, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Returns a mapping from all found languages to their respective directories.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1385:Assign_L34_C2", "label": "mytracks_path = GetMyTracksDir()", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "vector": [14, 1, 0.7556, 0.0222, 1, 0.55, 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_1385:Assign_L35_C2", "label": "res_dir = join()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "vector": [14, 1, 0.7778, 0.0222, 1, 0.55, 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_1385:Assign_L36_C2", "label": "language_dirs = glob()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "vector": [14, 1, 0.8, 0.0222, 1, 0.55, 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_1385:Assign_L37_C2", "label": "master_dir = join()", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "vector": [14, 1, 0.8222, 0.0222, 1, 0.55, 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_1385:If_L38_C2", "label": "if", "type": "if", "loc": [38, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "vector": [4, 1, 0.8556, 0.0444, 1, 0.55, 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_1385:If_L40_C2", "label": "if", "type": "if", "loc": [40, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "vector": [4, 1, 0.9, 0.0444, 1, 0.55, 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_1385:Assign_L43_C2", "label": "language_tuples =", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "vector": [14, 1, 0.9556, 0.0222, 1, 0.55, 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_1385:Expr_L44_C2", "label": "append()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "vector": [8, 1, 0.9778, 0.0222, 1, 0.55, 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_1385:Return_L45_C2", "label": "return", "type": "return", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "vector": [13, 1, 1.0, 0.0222, 1, 0.55, 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_1385:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1385:Expr_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1385:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1385:While_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1385:While_L20_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1385:If_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1385:While_L20_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1385:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1385:Return_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1385:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1385:Assign_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1385:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1385:Assign_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1385:Assign_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1385:If_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1385:If_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1385:Assign_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1385:Expr_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1385:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1385: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_1386 | 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_1386: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_1386: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_1386: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_1386: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_1386:Expr_L12_C2", "label": "expression", "type": "expression", "loc": [12, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:ClassDef_L11_C0", "vector": [8, 1, 0.1261, 0.0522, 1, 0.98, 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_1386:FunctionDef_L19_C2", "label": "Parse", "type": "function", "loc": [19, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:ClassDef_L11_C0", "vector": [2, 1, 0.3, 0.2783, 1, 0.98, 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_1386:Expr_L20_C4", "label": "expression", "type": "expression", "loc": [20, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "vector": [8, 2, 0.2435, 0.1478, 2, 0.62, 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_1386:Expr_L37_C4", "label": "_Reset()", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "vector": [8, 2, 0.3217, 0.0087, 2, 0.62, 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_1386:Assign_L40_C4", "label": "self._xml_parser = ParserCreate()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "vector": [14, 2, 0.3478, 0.0087, 2, 0.62, 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_1386:Assign_L41_C4", "label": "self._xml_parser.StartElementHandler =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "vector": [14, 2, 0.3565, 0.0087, 2, 0.62, 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_1386:Assign_L42_C4", "label": "self._xml_parser.EndElementHandler =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "vector": [14, 2, 0.3652, 0.0087, 2, 0.62, 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_1386:Assign_L43_C4", "label": "self._xml_parser.CharacterDataHandler =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "vector": [14, 2, 0.3739, 0.0087, 2, 0.62, 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_1386:Assign_L44_C4", "label": "self._xml_parser.CommentHandler =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "vector": [14, 2, 0.3826, 0.0087, 2, 0.62, 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_1386:Assign_L46_C4", "label": "file_obj = open()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "vector": [14, 2, 0.4, 0.0087, 2, 0.62, 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_1386:Expr_L47_C4", "label": "ParseFile()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "vector": [8, 2, 0.4087, 0.0087, 2, 0.62, 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_1386:Expr_L48_C4", "label": "close()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "vector": [8, 2, 0.4174, 0.0087, 2, 0.62, 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_1386:Return_L50_C4", "label": "return", "type": "return", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "vector": [13, 2, 0.4348, 0.0087, 2, 0.62, 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_1386:FunctionDef_L52_C2", "label": "_Reset", "type": "function", "loc": [52, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:ClassDef_L11_C0", "vector": [2, 1, 0.4696, 0.0435, 1, 0.98, 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_1386:Assign_L53_C4", "label": "self._currentString =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L52_C2", "vector": [14, 2, 0.4609, 0.0087, 2, 0.94, 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_1386:Assign_L54_C4", "label": "self._currentStringName =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L52_C2", "vector": [14, 2, 0.4696, 0.0087, 2, 0.94, 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_1386:Assign_L55_C4", "label": "self._currentStringValue =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L52_C2", "vector": [14, 2, 0.4783, 0.0087, 2, 0.94, 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_1386:Assign_L56_C4", "label": "self._all_strings =", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L52_C2", "vector": [14, 2, 0.487, 0.0087, 2, 0.94, 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_1386:FunctionDef_L58_C2", "label": "_StartElementHandler", "type": "function", "loc": [58, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:ClassDef_L11_C0", "vector": [2, 1, 0.5783, 0.1565, 1, 0.98, 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_1386:If_L59_C4", "label": "if", "type": "if", "loc": [59, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L58_C2", "vector": [4, 2, 0.5174, 0.0174, 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 name != 'string':\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1386:Return_L60_C6", "label": "return", "type": "return", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L59_C4", "vector": [13, 3, 0.5217, 0.0087, 3, 0.78, 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_1386:If_L62_C4", "label": "if", "type": "if", "loc": [62, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L58_C2", "vector": [4, 2, 0.5435, 0.0174, 2, 0.33, 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_1386:Return_L63_C6", "label": "return", "type": "return", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L62_C4", "vector": [13, 3, 0.5478, 0.0087, 3, 0.43, 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_1386:Assign_L67_C4", "label": "self._currentString =", "type": "assigned_variable", "loc": [67, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L58_C2", "vector": [14, 2, 0.5913, 0.0261, 2, 0.33, 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_1386:If_L71_C4", "label": "if", "type": "if", "loc": [71, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L58_C2", "vector": [4, 2, 0.6217, 0.0174, 2, 0.33, 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_1386:Assign_L72_C6", "label": "assign", "type": "assigned_variable", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L71_C4", "vector": [14, 3, 0.6261, 0.0087, 3, 0.14, 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_1386:Assign_L74_C4", "label": "self._currentStringName =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L58_C2", "vector": [14, 2, 0.6435, 0.0087, 2, 0.33, 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_1386:Assign_L75_C4", "label": "self._currentStringValue =", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L58_C2", "vector": [14, 2, 0.6522, 0.0087, 2, 0.33, 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_1386:FunctionDef_L77_C2", "label": "_EndElementHandler", "type": "function", "loc": [77, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:ClassDef_L11_C0", "vector": [2, 1, 0.7217, 0.113, 1, 0.98, 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_1386:If_L78_C4", "label": "if", "type": "if", "loc": [78, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L77_C2", "vector": [4, 2, 0.6826, 0.0174, 2, 0.75, 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_1386:Return_L79_C6", "label": "return", "type": "return", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L78_C4", "vector": [13, 3, 0.687, 0.0087, 3, 0.69, 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_1386:Assign_L83_C4", "label": "assign", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L77_C2", "vector": [14, 2, 0.7217, 0.0087, 2, 0.75, 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_1386:Assign_L84_C4", "label": "assign", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L77_C2", "vector": [14, 2, 0.7304, 0.0087, 2, 0.75, 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_1386:Assign_L85_C4", "label": "assign", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L77_C2", "vector": [14, 2, 0.7391, 0.0087, 2, 0.75, 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_1386:Assign_L87_C4", "label": "self._currentString =", "type": "assigned_variable", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L77_C2", "vector": [14, 2, 0.7565, 0.0087, 2, 0.75, 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_1386:Assign_L88_C4", "label": "self._currentStringName =", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L77_C2", "vector": [14, 2, 0.7652, 0.0087, 2, 0.75, 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_1386:Assign_L89_C4", "label": "self._currentStringValue =", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L77_C2", "vector": [14, 2, 0.7739, 0.0087, 2, 0.75, 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_1386:FunctionDef_L91_C2", "label": "_CharacterDataHandler", "type": "function", "loc": [91, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:ClassDef_L11_C0", "vector": [2, 1, 0.8087, 0.0435, 1, 0.98, 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_1386:If_L92_C4", "label": "if", "type": "if", "loc": [92, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L91_C2", "vector": [4, 2, 0.8043, 0.0174, 2, 0.66, 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_1386:Return_L93_C6", "label": "return", "type": "return", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L92_C4", "vector": [13, 3, 0.8087, 0.0087, 3, 0.66, 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_1386:Assign_L97_C2", "label": "_KEEP_PARENT_REGEX = compile()", "type": "assigned_variable", "loc": [97, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:ClassDef_L11_C0", "vector": [14, 1, 0.8565, 0.0348, 1, 0.98, 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_1386:FunctionDef_L102_C2", "label": "_CommentHandler", "type": "function", "loc": [102, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:ClassDef_L11_C0", "vector": [2, 1, 0.9435, 0.1217, 1, 0.98, 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_1386:Assign_L103_C4", "label": "keep_parent_match = match()", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L102_C2", "vector": [14, 2, 0.8957, 0.0087, 2, 0.17, 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_1386:If_L104_C4", "label": "if", "type": "if", "loc": [104, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L102_C2", "vector": [4, 2, 0.9087, 0.0174, 2, 0.17, 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_1386:Return_L105_C6", "label": "return", "type": "return", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L104_C4", "vector": [13, 3, 0.913, 0.0087, 3, 0.86, 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_1386:Assign_L107_C4", "label": "name = group()", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L102_C2", "vector": [14, 2, 0.9304, 0.0087, 2, 0.17, 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_1386:Assign_L108_C4", "label": "assign", "type": "assigned_variable", "loc": [108, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L102_C2", "vector": [14, 2, 0.9565, 0.0435, 2, 0.17, 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_1386:Assign_L113_C4", "label": "rev = group()", "type": "assigned_variable", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L102_C2", "vector": [14, 2, 0.9826, 0.0087, 2, 0.17, 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_1386:If_L114_C4", "label": "if", "type": "if", "loc": [114, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L102_C2", "vector": [4, 2, 0.9957, 0.0174, 2, 0.17, 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_1386:Assign_L115_C6", "label": "assign", "type": "assigned_variable", "loc": [115, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L114_C4", "vector": [14, 3, 1.0, 0.0087, 3, 0.78, 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_1386:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Expr_L12_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Return_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Return_L60_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Return_L63_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L72_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Return_L79_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Return_L93_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L97_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L102_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Return_L105_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1386:If_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1386:Assign_L115_C6"}] |
#
# Secret Labs' Regular Expression Engine
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# This version of the SRE library can be redistributed under CNRI's
# Python 1.6 license. For any other use, please contact Secret Labs
# AB (info@pythonware.com).
#
# Portions of this engine have been developed in cooperation with
# CNRI. Hewlett-Packard provided funding for 1.6 integration and
# other compatibility work.
#
# 2010-01-16 mrab Python front-end re-written and extended
r"""Support for regular expressions (RE).
This module provides regular expression matching operations similar to those
found in Perl. It supports both 8-bit and Unicode strings; both the pattern and
the strings being processed can contain null bytes and characters outside the
US ASCII range.
Regular expressions can contain both special and ordinary characters. Most
ordinary characters, like "A", "a", or "0", are the simplest regular
expressions; they simply match themselves. You can concatenate ordinary
characters, so last matches the string 'last'.
There are a few differences between the old (legacy) behaviour and the new
(enhanced) behaviour, which are indicated by VERSION0 or VERSION1.
The special characters are:
"." Matches any character except a newline.
"^" Matches the start of the string.
"$" Matches the end of the string or just before the
newline at the end of the string.
"*" Matches 0 or more (greedy) repetitions of the preceding
RE. Greedy means that it will match as many repetitions
as possible.
"+" Matches 1 or more (greedy) repetitions of the preceding
RE.
"?" Matches 0 or 1 (greedy) of the preceding RE.
*?,+?,?? Non-greedy versions of the previous three special
characters.
*+,++,?+ Possessive versions of the previous three special
characters.
{m,n} Matches from m to n repetitions of the preceding RE.
{m,n}? Non-greedy version of the above.
{m,n}+ Possessive version of the above.
{...} Fuzzy matching constraints.
"\\" Either escapes special characters or signals a special
sequence.
[...] Indicates a set of characters. A "^" as the first
character indicates a complementing set.
"|" A|B, creates an RE that will match either A or B.
(...) Matches the RE inside the parentheses. The contents are
captured and can be retrieved or matched later in the
string.
(?flags-flags) VERSION1: Sets/clears the flags for the remainder of
the group or pattern; VERSION0: Sets the flags for the
entire pattern.
(?:...) Non-capturing version of regular parentheses.
(?>...) Atomic non-capturing version of regular parentheses.
(?flags-flags:...) Non-capturing version of regular parentheses with local
flags.
(?P<name>...) The substring matched by the group is accessible by
name.
(?<name>...) The substring matched by the group is accessible by
name.
(?P=name) Matches the text matched earlier by the group named
name.
(?#...) A comment; ignored.
(?=...) Matches if ... matches next, but doesn't consume the
string.
(?!...) Matches if ... doesn't match next.
(?<=...) Matches if preceded by ....
(?<!...) Matches if not preceded by ....
(?(id)yes|no) Matches yes pattern if group id matched, the (optional)
no pattern otherwise.
(?|...|...) (?|A|B), creates an RE that will match either A or B,
but reuses capture group numbers across the
alternatives.
The fuzzy matching constraints are: "i" to permit insertions, "d" to permit
deletions, "s" to permit substitutions, "e" to permit any of these. Limits are
optional with "<=" and "<". If any type of error is provided then any type not
provided is not permitted.
A cost equation may be provided.
Examples:
(?:fuzzy){i<=2}
(?:fuzzy){i<=1,s<=2,d<=1,1i+1s+1d<3}
VERSION1: Set operators are supported, and a set can include nested sets. The
set operators, in order of increasing precedence, are:
|| Set union ("x||y" means "x or y").
~~ (double tilde) Symmetric set difference ("x~~y" means "x or y, but not
both").
&& Set intersection ("x&&y" means "x and y").
-- (double dash) Set difference ("x--y" means "x but not y").
Implicit union, ie, simple juxtaposition like in [ab], has the highest
precedence.
VERSION0 and VERSION1:
The special sequences consist of "\\" and a character from the list below. If
the ordinary character is not on the list, then the resulting RE will match the
second character.
\number Matches the contents of the group of the same number if
number is no more than 2 digits, otherwise the character
with the 3-digit octal code.
\a Matches the bell character.
\A Matches only at the start of the string.
\b Matches the empty string, but only at the start or end of a
word.
\B Matches the empty string, but not at the start or end of a
word.
\d Matches any decimal digit; equivalent to the set [0-9] when
matching a bytestring or a Unicode string with the ASCII
flag, or the whole range of Unicode digits when matching a
Unicode string.
\D Matches any non-digit character; equivalent to [^\d].
\f Matches the formfeed character.
\g<name> Matches the text matched by the group named name.
\G Matches the empty string, but only at the position where
the search started.
\L<name> Named list. The list is provided as a keyword argument.
\m Matches the empty string, but only at the start of a word.
\M Matches the empty string, but only at the end of a word.
\n Matches the newline character.
\N{name} Matches the named character.
\p{name=value} Matches the character if its property has the specified
value.
\P{name=value} Matches the character if its property hasn't the specified
value.
\r Matches the carriage-return character.
\s Matches any whitespace character; equivalent to
[ \t\n\r\f\v].
\S Matches any non-whitespace character; equivalent to [^\s].
\t Matches the tab character.
\uXXXX Matches the Unicode codepoint with 4-digit hex code XXXX.
\UXXXXXXXX Matches the Unicode codepoint with 8-digit hex code
XXXXXXXX.
\v Matches the vertical tab character.
\w Matches any alphanumeric character; equivalent to
[a-zA-Z0-9_] when matching a bytestring or a Unicode string
with the ASCII flag, or the whole range of Unicode
alphanumeric characters (letters plus digits plus
underscore) when matching a Unicode string. With LOCALE, it
will match the set [0-9_] plus characters defined as
letters for the current locale.
\W Matches the complement of \w; equivalent to [^\w].
\xXX Matches the character with 2-digit hex code XX.
\X Matches a grapheme.
\Z Matches only at the end of the string.
\\ Matches a literal backslash.
This module exports the following functions:
match Match a regular expression pattern at the beginning of a string.
fullmatch Match a regular expression pattern against all of a string.
search Search a string for the presence of a pattern.
sub Substitute occurrences of a pattern found in a string using a
template string.
subf Substitute occurrences of a pattern found in a string using a
format string.
subn Same as sub, but also return the number of substitutions made.
subfn Same as subf, but also return the number of substitutions made.
split Split a string by the occurrences of a pattern. VERSION1: will
split at zero-width match; VERSION0: won't split at zero-width
match.
splititer Return an iterator yielding the parts of a split string.
findall Find all occurrences of a pattern in a string.
finditer Return an iterator yielding a match object for each match.
compile Compile a pattern into a Pattern object.
purge Clear the regular expression cache.
escape Backslash all non-alphanumerics or special characters in a
string.
Most of the functions support a concurrent parameter: if True, the GIL will be
released during matching, allowing other Python threads to run concurrently. If
the string changes during matching, the behaviour is undefined. This parameter
is not needed when working on the builtin (immutable) string classes.
Some of the functions in this module take flags as optional parameters. Most of
these flags can also be set within an RE:
A a ASCII Make \w, \W, \b, \B, \d, and \D match the
corresponding ASCII character categories. Default
when matching a bytestring.
B b BESTMATCH Find the best fuzzy match (default is first).
D DEBUG Print the parsed pattern.
F f FULLCASE Use full case-folding when performing
case-insensitive matching in Unicode.
I i IGNORECASE Perform case-insensitive matching.
L L LOCALE Make \w, \W, \b, \B, \d, and \D dependent on the
current locale. (One byte per character only.)
M m MULTILINE "^" matches the beginning of lines (after a newline)
as well as the string. "$" matches the end of lines
(before a newline) as well as the end of the string.
E e ENHANCEMATCH Attempt to improve the fit after finding the first
fuzzy match.
R r REVERSE Searches backwards.
S s DOTALL "." matches any character at all, including the
newline.
U u UNICODE Make \w, \W, \b, \B, \d, and \D dependent on the
Unicode locale. Default when matching a Unicode
string.
V0 V0 VERSION0 Turn on the old legacy behaviour.
V1 V1 VERSION1 Turn on the new enhanced behaviour. This flag
includes the FULLCASE flag.
W w WORD Make \b and \B work with default Unicode word breaks
and make ".", "^" and "$" work with Unicode line
breaks.
X x VERBOSE Ignore whitespace and comments for nicer looking REs.
This module also defines an exception 'error'.
"""
# Public symbols.
__all__ = ["compile", "escape", "findall", "finditer", "fullmatch", "match",
"purge", "search", "split", "splititer", "sub", "subf", "subfn", "subn",
"template", "Scanner", "A", "ASCII", "B", "BESTMATCH", "D", "DEBUG", "E",
"ENHANCEMATCH", "S", "DOTALL", "F", "FULLCASE", "I", "IGNORECASE", "L",
"LOCALE", "M", "MULTILINE", "R", "REVERSE", "T", "TEMPLATE", "U", "UNICODE",
"V0", "VERSION0", "V1", "VERSION1", "X", "VERBOSE", "W", "WORD", "error",
"Regex"]
__version__ = "2.4.58"
# --------------------------------------------------------------------
# Public interface.
def match(pattern, string, flags=0, pos=None, endpos=None, partial=False,
concurrent=None, **kwargs):
"""Try to apply the pattern at the start of the string, returning a match
object, or None if no match was found."""
return _compile(pattern, flags, kwargs).match(string, pos, endpos,
concurrent, partial)
def fullmatch(pattern, string, flags=0, pos=None, endpos=None, partial=False,
concurrent=None, **kwargs):
"""Try to apply the pattern against all of the string, returning a match
object, or None if no match was found."""
return _compile(pattern, flags, kwargs).fullmatch(string, pos, endpos,
concurrent, partial)
def search(pattern, string, flags=0, pos=None, endpos=None, partial=False,
concurrent=None, **kwargs):
"""Search through string looking for a match to the pattern, returning a
match object, or None if no match was found."""
return _compile(pattern, flags, kwargs).search(string, pos, endpos,
concurrent, partial)
def sub(pattern, repl, string, count=0, flags=0, pos=None, endpos=None,
concurrent=None, **kwargs):
"""Return the string obtained by replacing the leftmost (or rightmost with a
reverse pattern) non-overlapping occurrences of the pattern in string by the
replacement repl. repl can be either a string or a callable; if a string,
backslash escapes in it are processed; if a callable, it's passed the match
object and must return a replacement string to be used."""
return _compile(pattern, flags, kwargs).sub(repl, string, count, pos,
endpos, concurrent)
def subf(pattern, format, string, count=0, flags=0, pos=None, endpos=None,
concurrent=None, **kwargs):
"""Return the string obtained by replacing the leftmost (or rightmost with a
reverse pattern) non-overlapping occurrences of the pattern in string by the
replacement format. format can be either a string or a callable; if a string,
it's treated as a format string; if a callable, it's passed the match object
and must return a replacement string to be used."""
return _compile(pattern, flags, kwargs).subf(format, string, count, pos,
endpos, concurrent)
def subn(pattern, repl, string, count=0, flags=0, pos=None, endpos=None,
concurrent=None, **kwargs):
"""Return a 2-tuple containing (new_string, number). new_string is the string
obtained by replacing the leftmost (or rightmost with a reverse pattern)
non-overlapping occurrences of the pattern in the source string by the
replacement repl. number is the number of substitutions that were made. repl
can be either a string or a callable; if a string, backslash escapes in it
are processed; if a callable, it's passed the match object and must return a
replacement string to be used."""
return _compile(pattern, flags, kwargs).subn(repl, string, count, pos,
endpos, concurrent)
def subfn(pattern, format, string, count=0, flags=0, pos=None, endpos=None,
concurrent=None, **kwargs):
"""Return a 2-tuple containing (new_string, number). new_string is the string
obtained by replacing the leftmost (or rightmost with a reverse pattern)
non-overlapping occurrences of the pattern in the source string by the
replacement format. number is the number of substitutions that were made. format
can be either a string or a callable; if a string, it's treated as a format
string; if a callable, it's passed the match object and must return a
replacement string to be used."""
return _compile(pattern, flags, kwargs).subfn(format, string, count, pos,
endpos, concurrent)
def split(pattern, string, maxsplit=0, flags=0, concurrent=None, **kwargs):
"""Split the source string by the occurrences of the pattern, returning a
list containing the resulting substrings. If capturing parentheses are used
in pattern, then the text of all groups in the pattern are also returned as
part of the resulting list. If maxsplit is nonzero, at most maxsplit splits
occur, and the remainder of the string is returned as the final element of
the list."""
return _compile(pattern, flags, kwargs).split(string, maxsplit, concurrent)
def splititer(pattern, string, maxsplit=0, flags=0, concurrent=None, **kwargs):
"Return an iterator yielding the parts of a split string."
return _compile(pattern, flags, kwargs).splititer(string, maxsplit,
concurrent)
def findall(pattern, string, flags=0, pos=None, endpos=None, overlapped=False,
concurrent=None, **kwargs):
"""Return a list of all matches in the string. The matches may be overlapped
if overlapped is True. If one or more groups are present in the pattern,
return a list of groups; this will be a list of tuples if the pattern has
more than one group. Empty matches are included in the result."""
return _compile(pattern, flags, kwargs).findall(string, pos, endpos,
overlapped, concurrent)
def finditer(pattern, string, flags=0, pos=None, endpos=None, overlapped=False,
partial=False, concurrent=None, **kwargs):
"""Return an iterator over all matches in the string. The matches may be
overlapped if overlapped is True. For each match, the iterator returns a
match object. Empty matches are included in the result."""
return _compile(pattern, flags, kwargs).finditer(string, pos, endpos,
overlapped, concurrent, partial)
def compile(pattern, flags=0, **kwargs):
"Compile a regular expression pattern, returning a pattern object."
return _compile(pattern, flags, kwargs)
def purge():
"Clear the regular expression cache"
_cache.clear()
_locale_sensitive.clear()
def template(pattern, flags=0):
"Compile a template pattern, returning a pattern object."
return _compile(pattern, flags | TEMPLATE)
def escape(pattern, special_only=False):
"Escape all non-alphanumeric characters or special characters in pattern."
if isinstance(pattern, unicode):
s = []
if special_only:
for c in pattern:
if c in _METACHARS:
s.append(u"\\")
s.append(c)
elif c == u"\x00":
s.append(u"\\000")
else:
s.append(c)
else:
for c in pattern:
if c in _ALNUM:
s.append(c)
elif c == u"\x00":
s.append(u"\\000")
else:
s.append(u"\\")
s.append(c)
return u"".join(s)
else:
s = []
if special_only:
for c in pattern:
if c in _METACHARS:
s.append("\\")
s.append(c)
elif c == "\x00":
s.append("\\000")
else:
s.append(c)
else:
for c in pattern:
if c in _ALNUM:
s.append(c)
elif c == "\x00":
s.append("\\000")
else:
s.append("\\")
s.append(c)
return "".join(s)
# --------------------------------------------------------------------
# Internals.
import _regex_core
import _regex
from threading import RLock as _RLock
from locale import getlocale as _getlocale
from _regex_core import *
from _regex_core import (_ALL_VERSIONS, _ALL_ENCODINGS, _FirstSetError,
_UnscopedFlagSet, _check_group_features, _compile_firstset,
_compile_replacement, _flatten_code, _fold_case, _get_required_string,
_parse_pattern, _shrink_cache)
from _regex_core import (ALNUM as _ALNUM, Info as _Info, OP as _OP, Source as
_Source, Fuzzy as _Fuzzy)
# Version 0 is the old behaviour, compatible with the original 're' module.
# Version 1 is the new behaviour, which differs slightly.
DEFAULT_VERSION = VERSION0
_METACHARS = frozenset("()[]{}?*+|^$\\.")
_regex_core.DEFAULT_VERSION = DEFAULT_VERSION
# Caches for the patterns and replacements.
_cache = {}
_cache_lock = _RLock()
_named_args = {}
_replacement_cache = {}
_locale_sensitive = {}
# Maximum size of the cache.
_MAXCACHE = 500
_MAXREPCACHE = 500
def _compile(pattern, flags=0, kwargs={}):
"Compiles a regular expression to a PatternObject."
# We won't bother to cache the pattern if we're debugging.
debugging = (flags & DEBUG) != 0
# What locale is this pattern using?
locale_key = (type(pattern), pattern)
if _locale_sensitive.get(locale_key, True) or (flags & LOCALE) != 0:
# This pattern is, or might be, locale-sensitive.
pattern_locale = _getlocale()[1]
else:
# This pattern is definitely not locale-sensitive.
pattern_locale = None
if not debugging:
try:
# Do we know what keyword arguments are needed?
args_key = pattern, type(pattern), flags
args_needed = _named_args[args_key]
# Are we being provided with its required keyword arguments?
args_supplied = set()
if args_needed:
for k, v in args_needed:
try:
args_supplied.add((k, frozenset(kwargs[k])))
except KeyError:
raise error("missing named list: {!r}".format(k))
args_supplied = frozenset(args_supplied)
# Have we already seen this regular expression and named list?
pattern_key = (pattern, type(pattern), flags, args_supplied,
DEFAULT_VERSION, pattern_locale)
return _cache[pattern_key]
except KeyError:
# It's a new pattern, or new named list for a known pattern.
pass
# Guess the encoding from the class of the pattern string.
if isinstance(pattern, unicode):
guess_encoding = UNICODE
elif isinstance(pattern, str):
guess_encoding = ASCII
elif isinstance(pattern, _pattern_type):
if flags:
raise ValueError("cannot process flags argument with a compiled pattern")
return pattern
else:
raise TypeError("first argument must be a string or compiled pattern")
# Set the default version in the core code in case it has been changed.
_regex_core.DEFAULT_VERSION = DEFAULT_VERSION
caught_exception = None
global_flags = flags
while True:
try:
source = _Source(pattern)
info = _Info(global_flags, source.char_type, kwargs)
info.guess_encoding = guess_encoding
source.ignore_space = bool(info.flags & VERBOSE)
parsed = _parse_pattern(source, info)
break
except _UnscopedFlagSet:
# Remember the global flags for the next attempt.
global_flags = info.global_flags
except error, e:
caught_exception = e
if caught_exception:
raise error(caught_exception.msg, caught_exception.pattern,
caught_exception.pos)
if not source.at_end():
raise error("trailing characters in pattern", pattern, source.pos)
# Check the global flags for conflicts.
version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION
if version not in (0, VERSION0, VERSION1):
raise ValueError("VERSION0 and VERSION1 flags are mutually incompatible")
if (info.flags & _ALL_ENCODINGS) not in (0, ASCII, LOCALE, UNICODE):
raise ValueError("ASCII, LOCALE and UNICODE flags are mutually incompatible")
if not (info.flags & _ALL_ENCODINGS):
if isinstance(pattern, unicode):
info.flags |= UNICODE
else:
info.flags |= ASCII
reverse = bool(info.flags & REVERSE)
fuzzy = isinstance(parsed, _Fuzzy)
# Remember whether this pattern as an inline locale flag.
_locale_sensitive[locale_key] = info.inline_locale
# Should we print the parsed pattern?
if flags & DEBUG:
parsed.dump(indent=0, reverse=reverse)
# Fix the group references.
parsed.fix_groups(pattern, reverse, False)
# Optimise the parsed pattern.
parsed = parsed.optimise(info)
parsed = parsed.pack_characters(info)
# Get the required string.
req_offset, req_chars, req_flags = _get_required_string(parsed, info.flags)
# Build the named lists.
named_lists = {}
named_list_indexes = [None] * len(info.named_lists_used)
args_needed = set()
for key, index in info.named_lists_used.items():
name, case_flags = key
values = frozenset(kwargs[name])
if case_flags:
items = frozenset(_fold_case(info, v) for v in values)
else:
items = values
named_lists[name] = values
named_list_indexes[index] = items
args_needed.add((name, values))
# Check the features of the groups.
_check_group_features(info, parsed)
# Compile the parsed pattern. The result is a list of tuples.
code = parsed.compile(reverse)
# Is there a group call to the pattern as a whole?
key = (0, reverse, fuzzy)
ref = info.call_refs.get(key)
if ref is not None:
code = [(_OP.CALL_REF, ref)] + code + [(_OP.END, )]
# Add the final 'success' opcode.
code += [(_OP.SUCCESS, )]
# Compile the additional copies of the groups that we need.
for group, rev, fuz in info.additional_groups:
code += group.compile(rev, fuz)
# Flatten the code into a list of ints.
code = _flatten_code(code)
if not parsed.has_simple_start():
# Get the first set, if possible.
try:
fs_code = _compile_firstset(info, parsed.get_firstset(reverse))
fs_code = _flatten_code(fs_code)
code = fs_code + code
except _FirstSetError:
pass
# The named capture groups.
index_group = dict((v, n) for n, v in info.group_index.items())
# Create the PatternObject.
#
# Local flags like IGNORECASE affect the code generation, but aren't needed
# by the PatternObject itself. Conversely, global flags like LOCALE _don't_
# affect the code generation but _are_ needed by the PatternObject.
compiled_pattern = _regex.compile(pattern, info.flags | version, code,
info.group_index, index_group, named_lists, named_list_indexes,
req_offset, req_chars, req_flags, info.group_count)
# Do we need to reduce the size of the cache?
if len(_cache) >= _MAXCACHE:
_cache_lock.acquire()
try:
_shrink_cache(_cache, _named_args, _locale_sensitive, _MAXCACHE)
finally:
_cache_lock.release()
if not debugging:
if (info.flags & LOCALE) == 0:
pattern_locale = None
args_needed = frozenset(args_needed)
# Store this regular expression and named list.
pattern_key = (pattern, type(pattern), flags, args_needed,
DEFAULT_VERSION, pattern_locale)
_cache[pattern_key] = compiled_pattern
# Store what keyword arguments are needed.
_named_args[args_key] = args_needed
return compiled_pattern
def _compile_replacement_helper(pattern, template):
"Compiles a replacement template."
# This function is called by the _regex module.
# Have we seen this before?
key = pattern.pattern, pattern.flags, template
compiled = _replacement_cache.get(key)
if compiled is not None:
return compiled
if len(_replacement_cache) >= _MAXREPCACHE:
_replacement_cache.clear()
is_unicode = isinstance(template, unicode)
source = _Source(template)
if is_unicode:
def make_string(char_codes):
return u"".join(unichr(c) for c in char_codes)
else:
def make_string(char_codes):
return "".join(chr(c) for c in char_codes)
compiled = []
literal = []
while True:
ch = source.get()
if not ch:
break
if ch == "\\":
# '_compile_replacement' will return either an int group reference
# or a string literal. It returns items (plural) in order to handle
# a 2-character literal (an invalid escape sequence).
is_group, items = _compile_replacement(source, pattern, is_unicode)
if is_group:
# It's a group, so first flush the literal.
if literal:
compiled.append(make_string(literal))
literal = []
compiled.extend(items)
else:
literal.extend(items)
else:
literal.append(ord(ch))
# Flush the literal.
if literal:
compiled.append(make_string(literal))
_replacement_cache[key] = compiled
return compiled
# We define _pattern_type here after all the support objects have been defined.
_pattern_type = type(_compile("", 0, {}))
# We'll define an alias for the 'compile' function so that the repr of a
# pattern object is eval-able.
Regex = compile
# Register myself for pickling.
import copy_reg as _copy_reg
def _pickle(p):
return _compile, (p.pattern, p.flags)
_copy_reg.pickle(_pattern_type, _pickle, _compile)
if not hasattr(str, "format"):
# Strings don't have the .format method (below Python 2.6).
while True:
_start = __doc__.find(" subf")
if _start < 0:
break
_end = __doc__.find("\n", _start) + 1
while __doc__.startswith(" ", _end):
_end = __doc__.find("\n", _end) + 1
__doc__ = __doc__[ : _start] + __doc__[_end : ]
__all__ = [_name for _name in __all__ if not _name.startswith("subf")]
del _start, _end
del subf, subfn
| ajibawa-2023/Python-Code-Large/train/row_1388 | 242 | 703 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L16_C0", "label": "expression", "type": "expression", "loc": [16, 217], "level": 0, "parent": null, "vector": [8, 0, 0.1657, 0.2873, 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\"\"\"Support for regular expressions (RE).\n\nThis module provides regular expression matching operations similar to those\nfound in Perl. It supports both 8-bit and Unicode strings; both the pattern and\nthe strings being processed can contain null bytes and characters outside the\nUS ASCII range.\n\nRegular expressions can contain both special and ordinary characters. Most"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L220_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [220, 226], "level": 0, "parent": null, "vector": [14, 0, 0.3172, 0.01, 0, 0.66, 0.0238, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = [\"compile\", \"escape\", \"findall\", \"finditer\", \"fullmatch\", \"match\",\n \"purge\", \"search\", \"split\", \"splititer\", \"sub\", \"subf\", \"subfn\", \"subn\",\n \"template\", \"Scanner\", \"A\", \"ASCII\", \"B\", \"BESTMATCH\", \"D\", \"DEBUG\", \"E\",\n \"ENHANCEMATCH\", \"S\", \"DOTALL\", \"F\", \"FULLCASE\", \"I\", \"IGNORECASE\", \"L\",\n \"LOCALE\", \"M\", \"MULTILINE\", \"R\", \"REVERSE\", \"T\", \"TEMPLATE\", \"U\", \"UNICODE\",\n \"V0\", \"VERSION0\", \"V1\", \"VERSION1\", \"X\", \"VERBOSE\", \"W\", \"WORD\", \"error\",\n \"Regex\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L228_C0", "label": "__version__ =", "type": "assigned_variable", "loc": [228, 228], "level": 0, "parent": null, "vector": [14, 0, 0.3243, 0.0014, 0, 0.66, 0.0476, 162, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__version__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__version__ = \"2.4.58\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L233_C0", "label": "match", "type": "function", "loc": [233, 238], "level": 0, "parent": null, "vector": [2, 0, 0.335, 0.0085, 0, 0.66, 0.0714, 36, 0, 8, 1, 0, 0, 0, 2], "semantic": {"name": "match", "arg_names": ["pattern", "string", "flags", "pos", "endpos", "partial", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def match(pattern, string, flags=0, pos=None, endpos=None, partial=False,\n concurrent=None, **kwargs):\n \"\"\"Try to apply the pattern at the start of the string, returning a match\n object, or None if no match was found.\"\"\"\n return _compile(pattern, flags, kwargs).match(string, pos, endpos,\n concurrent, partial)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L235_C4", "label": "expression", "type": "expression", "loc": [235, 236], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L233_C0", "vector": [8, 1, 0.335, 0.0028, 1, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Try to apply the pattern at the start of the string, returning a match\n object, or None if no match was found.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L237_C4", "label": "return", "type": "return", "loc": [237, 238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L233_C0", "vector": [13, 1, 0.3378, 0.0028, 1, 0.27, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).match(string, pos, endpos,\n concurrent, partial)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L240_C0", "label": "fullmatch", "type": "function", "loc": [240, 245], "level": 0, "parent": null, "vector": [2, 0, 0.345, 0.0085, 0, 0.66, 0.0952, 188, 0, 8, 1, 0, 0, 0, 2], "semantic": {"name": "fullmatch", "arg_names": ["pattern", "string", "flags", "pos", "endpos", "partial", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def fullmatch(pattern, string, flags=0, pos=None, endpos=None, partial=False,\n concurrent=None, **kwargs):\n \"\"\"Try to apply the pattern against all of the string, returning a match\n object, or None if no match was found.\"\"\"\n return _compile(pattern, flags, kwargs).fullmatch(string, pos, endpos,\n concurrent, partial)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L242_C4", "label": "expression", "type": "expression", "loc": [242, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L240_C0", "vector": [8, 1, 0.345, 0.0028, 1, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Try to apply the pattern against all of the string, returning a match\n object, or None if no match was found.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L244_C4", "label": "return", "type": "return", "loc": [244, 245], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L240_C0", "vector": [13, 1, 0.3478, 0.0028, 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 _compile(pattern, flags, kwargs).fullmatch(string, pos, endpos,\n concurrent, partial)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L247_C0", "label": "search", "type": "function", "loc": [247, 252], "level": 0, "parent": null, "vector": [2, 0, 0.3549, 0.0085, 0, 0.66, 0.119, 163, 0, 8, 1, 0, 0, 0, 2], "semantic": {"name": "search", "arg_names": ["pattern", "string", "flags", "pos", "endpos", "partial", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def search(pattern, string, flags=0, pos=None, endpos=None, partial=False,\n concurrent=None, **kwargs):\n \"\"\"Search through string looking for a match to the pattern, returning a\n match object, or None if no match was found.\"\"\"\n return _compile(pattern, flags, kwargs).search(string, pos, endpos,\n concurrent, partial)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L249_C4", "label": "expression", "type": "expression", "loc": [249, 250], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L247_C0", "vector": [8, 1, 0.3549, 0.0028, 1, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Search through string looking for a match to the pattern, returning a\n match object, or None if no match was found.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L251_C4", "label": "return", "type": "return", "loc": [251, 252], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L247_C0", "vector": [13, 1, 0.3578, 0.0028, 1, 0.39, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).search(string, pos, endpos,\n concurrent, partial)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L254_C0", "label": "sub", "type": "function", "loc": [254, 262], "level": 0, "parent": null, "vector": [2, 0, 0.367, 0.0128, 0, 0.66, 0.1429, 819, 0, 9, 1, 0, 0, 0, 2], "semantic": {"name": "sub", "arg_names": ["pattern", "repl", "string", "count", "flags", "pos", "endpos", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def sub(pattern, repl, string, count=0, flags=0, pos=None, endpos=None,\n concurrent=None, **kwargs):\n \"\"\"Return the string obtained by replacing the leftmost (or rightmost with a\n reverse pattern) non-overlapping occurrences of the pattern in string by the\n replacement repl. repl can be either a string or a callable; if a string,\n backslash escapes in it are processed; if a callable, it's passed the match\n object and must return a replacement string to be used.\"\"\"\n return _compile(pattern, flags, kwargs).sub(repl, string, count, pos,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L256_C4", "label": "expression", "type": "expression", "loc": [256, 260], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L254_C0", "vector": [8, 1, 0.367, 0.0071, 1, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return the string obtained by replacing the leftmost (or rightmost with a\n reverse pattern) non-overlapping occurrences of the pattern in string by the\n replacement repl. repl can be either a string or a callable; if a string,\n backslash escapes in it are processed; if a callable, it's passed the match\n object and must return a replacement string to be used.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L261_C4", "label": "return", "type": "return", "loc": [261, 262], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L254_C0", "vector": [13, 1, 0.372, 0.0028, 1, 0.82, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).sub(repl, string, count, pos,\n endpos, concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L264_C0", "label": "subf", "type": "function", "loc": [264, 272], "level": 0, "parent": null, "vector": [2, 0, 0.3812, 0.0128, 0, 0.66, 0.1667, 65, 0, 9, 1, 0, 0, 0, 2], "semantic": {"name": "subf", "arg_names": ["pattern", "format", "string", "count", "flags", "pos", "endpos", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def subf(pattern, format, string, count=0, flags=0, pos=None, endpos=None,\n concurrent=None, **kwargs):\n \"\"\"Return the string obtained by replacing the leftmost (or rightmost with a\n reverse pattern) non-overlapping occurrences of the pattern in string by the\n replacement format. format can be either a string or a callable; if a string,\n it's treated as a format string; if a callable, it's passed the match object\n and must return a replacement string to be used.\"\"\"\n return _compile(pattern, flags, kwargs).subf(format, string, count, pos,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L266_C4", "label": "expression", "type": "expression", "loc": [266, 270], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L264_C0", "vector": [8, 1, 0.3812, 0.0071, 1, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return the string obtained by replacing the leftmost (or rightmost with a\n reverse pattern) non-overlapping occurrences of the pattern in string by the\n replacement format. format can be either a string or a callable; if a string,\n it's treated as a format string; if a callable, it's passed the match object\n and must return a replacement string to be used.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L271_C4", "label": "return", "type": "return", "loc": [271, 272], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L264_C0", "vector": [13, 1, 0.3862, 0.0028, 1, 0.98, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).subf(format, string, count, pos,\n endpos, concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L274_C0", "label": "subn", "type": "function", "loc": [274, 284], "level": 0, "parent": null, "vector": [2, 0, 0.3969, 0.0156, 0, 0.66, 0.1905, 556, 0, 9, 1, 0, 0, 0, 2], "semantic": {"name": "subn", "arg_names": ["pattern", "repl", "string", "count", "flags", "pos", "endpos", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def subn(pattern, repl, string, count=0, flags=0, pos=None, endpos=None,\n concurrent=None, **kwargs):\n \"\"\"Return a 2-tuple containing (new_string, number). new_string is the string\n obtained by replacing the leftmost (or rightmost with a reverse pattern)\n non-overlapping occurrences of the pattern in the source string by the\n replacement repl. number is the number of substitutions that were made. repl\n can be either a string or a callable; if a string, backslash escapes in it\n are processed; if a callable, it's passed the match object and must return a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L276_C4", "label": "expression", "type": "expression", "loc": [276, 282], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L274_C0", "vector": [8, 1, 0.3969, 0.01, 1, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a 2-tuple containing (new_string, number). new_string is the string\n obtained by replacing the leftmost (or rightmost with a reverse pattern)\n non-overlapping occurrences of the pattern in the source string by the\n replacement repl. number is the number of substitutions that were made. repl\n can be either a string or a callable; if a string, backslash escapes in it\n are processed; if a callable, it's passed the match object and must return a\n replacement string to be used.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L283_C4", "label": "return", "type": "return", "loc": [283, 284], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L274_C0", "vector": [13, 1, 0.4033, 0.0028, 1, 0.35, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).subn(repl, string, count, pos,\n endpos, concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L286_C0", "label": "subfn", "type": "function", "loc": [286, 296], "level": 0, "parent": null, "vector": [2, 0, 0.4139, 0.0156, 0, 0.66, 0.2143, 739, 0, 9, 1, 0, 0, 0, 2], "semantic": {"name": "subfn", "arg_names": ["pattern", "format", "string", "count", "flags", "pos", "endpos", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def subfn(pattern, format, string, count=0, flags=0, pos=None, endpos=None,\n concurrent=None, **kwargs):\n \"\"\"Return a 2-tuple containing (new_string, number). new_string is the string\n obtained by replacing the leftmost (or rightmost with a reverse pattern)\n non-overlapping occurrences of the pattern in the source string by the\n replacement format. number is the number of substitutions that were made. format\n can be either a string or a callable; if a string, it's treated as a format\n string; if a callable, it's passed the match object and must return a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L288_C4", "label": "expression", "type": "expression", "loc": [288, 294], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L286_C0", "vector": [8, 1, 0.4139, 0.01, 1, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a 2-tuple containing (new_string, number). new_string is the string\n obtained by replacing the leftmost (or rightmost with a reverse pattern)\n non-overlapping occurrences of the pattern in the source string by the\n replacement format. number is the number of substitutions that were made. format\n can be either a string or a callable; if a string, it's treated as a format\n string; if a callable, it's passed the match object and must return a\n replacement string to be used.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L295_C4", "label": "return", "type": "return", "loc": [295, 296], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L286_C0", "vector": [13, 1, 0.4203, 0.0028, 1, 0.45, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).subfn(format, string, count, pos,\n endpos, concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L298_C0", "label": "split", "type": "function", "loc": [298, 305], "level": 0, "parent": null, "vector": [2, 0, 0.4289, 0.0114, 0, 0.66, 0.2381, 908, 0, 6, 1, 0, 0, 0, 2], "semantic": {"name": "split", "arg_names": ["pattern", "string", "maxsplit", "flags", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def split(pattern, string, maxsplit=0, flags=0, concurrent=None, **kwargs):\n \"\"\"Split the source string by the occurrences of the pattern, returning a\n list containing the resulting substrings. If capturing parentheses are used\n in pattern, then the text of all groups in the pattern are also returned as\n part of the resulting list. If maxsplit is nonzero, at most maxsplit splits\n occur, and the remainder of the string is returned as the final element of\n the list.\"\"\"\n return _compile(pattern, flags, kwargs).split(string, maxsplit, concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L299_C4", "label": "expression", "type": "expression", "loc": [299, 304], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L298_C0", "vector": [8, 1, 0.4289, 0.0085, 1, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Split the source string by the occurrences of the pattern, returning a\n list containing the resulting substrings. If capturing parentheses are used\n in pattern, then the text of all groups in the pattern are also returned as\n part of the resulting list. If maxsplit is nonzero, at most maxsplit splits\n occur, and the remainder of the string is returned as the final element of\n the list.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L305_C4", "label": "return", "type": "return", "loc": [305, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L298_C0", "vector": [13, 1, 0.4339, 0.0014, 1, 0.09, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).split(string, maxsplit, concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L307_C0", "label": "splititer", "type": "function", "loc": [307, 310], "level": 0, "parent": null, "vector": [2, 0, 0.4388, 0.0057, 0, 0.66, 0.2619, 145, 0, 6, 1, 0, 0, 0, 2], "semantic": {"name": "splititer", "arg_names": ["pattern", "string", "maxsplit", "flags", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def splititer(pattern, string, maxsplit=0, flags=0, concurrent=None, **kwargs):\n \"Return an iterator yielding the parts of a split string.\"\n return _compile(pattern, flags, kwargs).splititer(string, maxsplit,\n concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L308_C4", "label": "expression", "type": "expression", "loc": [308, 308], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L307_C0", "vector": [8, 1, 0.4381, 0.0014, 1, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Return an iterator yielding the parts of a split string.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L309_C4", "label": "return", "type": "return", "loc": [309, 310], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L307_C0", "vector": [13, 1, 0.4403, 0.0028, 1, 0.85, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).splititer(string, maxsplit,\n concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L312_C0", "label": "findall", "type": "function", "loc": [312, 319], "level": 0, "parent": null, "vector": [2, 0, 0.4488, 0.0114, 0, 0.66, 0.2857, 737, 0, 8, 1, 0, 0, 0, 2], "semantic": {"name": "findall", "arg_names": ["pattern", "string", "flags", "pos", "endpos", "overlapped", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def findall(pattern, string, flags=0, pos=None, endpos=None, overlapped=False,\n concurrent=None, **kwargs):\n \"\"\"Return a list of all matches in the string. The matches may be overlapped\n if overlapped is True. If one or more groups are present in the pattern,\n return a list of groups; this will be a list of tuples if the pattern has\n more than one group. Empty matches are included in the result.\"\"\"\n return _compile(pattern, flags, kwargs).findall(string, pos, endpos,\n overlapped, concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L314_C4", "label": "expression", "type": "expression", "loc": [314, 317], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L312_C0", "vector": [8, 1, 0.4488, 0.0057, 1, 0.81, 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 all matches in the string. The matches may be overlapped\n if overlapped is True. If one or more groups are present in the pattern,\n return a list of groups; this will be a list of tuples if the pattern has\n more than one group. Empty matches are included in the result.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L318_C4", "label": "return", "type": "return", "loc": [318, 319], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L312_C0", "vector": [13, 1, 0.4531, 0.0028, 1, 0.81, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).findall(string, pos, endpos,\n overlapped, concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L321_C0", "label": "finditer", "type": "function", "loc": [321, 327], "level": 0, "parent": null, "vector": [2, 0, 0.4609, 0.01, 0, 0.66, 0.3095, 131, 0, 9, 1, 0, 0, 0, 2], "semantic": {"name": "finditer", "arg_names": ["pattern", "string", "flags", "pos", "endpos", "overlapped", "partial", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def finditer(pattern, string, flags=0, pos=None, endpos=None, overlapped=False,\n partial=False, concurrent=None, **kwargs):\n \"\"\"Return an iterator over all matches in the string. The matches may be\n overlapped if overlapped is True. For each match, the iterator returns a\n match object. Empty matches are included in the result.\"\"\"\n return _compile(pattern, flags, kwargs).finditer(string, pos, endpos,\n overlapped, concurrent, partial)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L323_C4", "label": "expression", "type": "expression", "loc": [323, 325], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L321_C0", "vector": [8, 1, 0.4609, 0.0043, 1, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return an iterator over all matches in the string. The matches may be\n overlapped if overlapped is True. For each match, the iterator returns a\n match object. Empty matches are included in the result.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L326_C4", "label": "return", "type": "return", "loc": [326, 327], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L321_C0", "vector": [13, 1, 0.4644, 0.0028, 1, 0.38, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).finditer(string, pos, endpos,\n overlapped, concurrent, partial)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L329_C0", "label": "compile", "type": "function", "loc": [329, 331], "level": 0, "parent": null, "vector": [2, 0, 0.4694, 0.0043, 0, 0.66, 0.3333, 821, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "compile", "arg_names": ["pattern", "flags", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def compile(pattern, flags=0, **kwargs):\n \"Compile a regular expression pattern, returning a pattern object.\"\n return _compile(pattern, flags, kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L330_C4", "label": "expression", "type": "expression", "loc": [330, 330], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L329_C0", "vector": [8, 1, 0.4694, 0.0014, 1, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Compile a regular expression pattern, returning a pattern object.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L331_C4", "label": "return", "type": "return", "loc": [331, 331], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L329_C0", "vector": [13, 1, 0.4708, 0.0014, 1, 0.1, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L333_C0", "label": "purge", "type": "function", "loc": [333, 336], "level": 0, "parent": null, "vector": [2, 0, 0.4758, 0.0057, 0, 0.66, 0.3571, 919, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "purge", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def purge():\n \"Clear the regular expression cache\"\n _cache.clear()\n _locale_sensitive.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L334_C4", "label": "expression", "type": "expression", "loc": [334, 334], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L333_C0", "vector": [8, 1, 0.4751, 0.0014, 1, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Clear the regular expression cache\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L335_C4", "label": "clear()", "type": "expression", "loc": [335, 335], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L333_C0", "vector": [8, 1, 0.4765, 0.0014, 1, 0.05, 0.5, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " _cache.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L336_C4", "label": "clear()", "type": "expression", "loc": [336, 336], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L333_C0", "vector": [8, 1, 0.478, 0.0014, 1, 0.05, 1.0, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " _locale_sensitive.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L338_C0", "label": "template", "type": "function", "loc": [338, 340], "level": 0, "parent": null, "vector": [2, 0, 0.4822, 0.0043, 0, 0.66, 0.381, 549, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "template", "arg_names": ["pattern", "flags"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def template(pattern, flags=0):\n \"Compile a template pattern, returning a pattern object.\"\n return _compile(pattern, flags | TEMPLATE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L339_C4", "label": "expression", "type": "expression", "loc": [339, 339], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L338_C0", "vector": [8, 1, 0.4822, 0.0014, 1, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Compile a template pattern, returning a pattern object.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L340_C4", "label": "return", "type": "return", "loc": [340, 340], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L338_C0", "vector": [13, 1, 0.4836, 0.0014, 1, 0.56, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags | TEMPLATE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L342_C0", "label": "escape", "type": "function", "loc": [342, 387], "level": 0, "parent": null, "vector": [2, 0, 0.5185, 0.0654, 0, 0.66, 0.4048, 494, 0, 2, 1, 0, 0, 0, 19], "semantic": {"name": "escape", "arg_names": ["pattern", "special_only"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def escape(pattern, special_only=False):\n \"Escape all non-alphanumeric characters or special characters in pattern.\"\n if isinstance(pattern, unicode):\n s = []\n if special_only:\n for c in pattern:\n if c in _METACHARS:\n s.append(u\"\\\\\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L343_C4", "label": "expression", "type": "expression", "loc": [343, 343], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L342_C0", "vector": [8, 1, 0.4879, 0.0014, 1, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Escape all non-alphanumeric characters or special characters in pattern.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L344_C4", "label": "if", "type": "if", "loc": [344, 387], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L342_C0", "vector": [4, 1, 0.5199, 0.0626, 1, 0.93, 1.0, 0, 3, 0, 0, 0, 0, 0, 19], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(pattern, unicode):\n s = []\n if special_only:\n for c in pattern:\n if c in _METACHARS:\n s.append(u\"\\\\\")\n s.append(c)\n elif c == u\"\\x00\":"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L345_C8", "label": "s =", "type": "assigned_variable", "loc": [345, 345], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L344_C4", "vector": [14, 2, 0.4908, 0.0014, 2, 0.95, 0.0, 553, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L346_C8", "label": "if", "type": "if", "loc": [346, 363], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L344_C4", "vector": [4, 2, 0.5043, 0.0256, 2, 0.95, 0.2, 0, 2, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if special_only:\n for c in pattern:\n if c in _METACHARS:\n s.append(u\"\\\\\")\n s.append(c)\n elif c == u\"\\x00\":\n s.append(u\"\\\\000\")\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L347_C12", "label": "for c", "type": "for", "loc": [347, 354], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L346_C8", "vector": [6, 3, 0.4986, 0.0114, 3, 0.34, 0.0, 411, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in pattern:\n if c in _METACHARS:\n s.append(u\"\\\\\")\n s.append(c)\n elif c == u\"\\x00\":\n s.append(u\"\\\\000\")\n else:\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L348_C16", "label": "if", "type": "if", "loc": [348, 354], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L347_C12", "vector": [4, 4, 0.4993, 0.01, 4, 0.24, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if c in _METACHARS:\n s.append(u\"\\\\\")\n s.append(c)\n elif c == u\"\\x00\":\n s.append(u\"\\\\000\")\n else:\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L349_C20", "label": "append()", "type": "expression", "loc": [349, 349], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L348_C16", "vector": [8, 5, 0.4964, 0.0014, 5, 0.47, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " s.append(u\"\\\\\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L350_C20", "label": "append()", "type": "expression", "loc": [350, 350], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L348_C16", "vector": [8, 5, 0.4979, 0.0014, 5, 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": " s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L351_C16", "label": "if", "type": "if", "loc": [351, 354], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L348_C16", "vector": [4, 5, 0.5014, 0.0057, 5, 0.47, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif c == u\"\\x00\":\n s.append(u\"\\\\000\")\n else:\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L352_C20", "label": "append()", "type": "expression", "loc": [352, 352], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L351_C16", "vector": [8, 6, 0.5007, 0.0014, 6, 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": " s.append(u\"\\\\000\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L354_C20", "label": "append()", "type": "expression", "loc": [354, 354], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L351_C16", "vector": [8, 6, 0.5036, 0.0014, 6, 0.54, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L356_C12", "label": "for c", "type": "for", "loc": [356, 363], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L346_C8", "vector": [6, 3, 0.5114, 0.0114, 3, 0.34, 1.0, 411, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in pattern:\n if c in _ALNUM:\n s.append(c)\n elif c == u\"\\x00\":\n s.append(u\"\\\\000\")\n else:\n s.append(u\"\\\\\")\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L357_C16", "label": "if", "type": "if", "loc": [357, 363], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L356_C12", "vector": [4, 4, 0.5121, 0.01, 4, 0.42, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if c in _ALNUM:\n s.append(c)\n elif c == u\"\\x00\":\n s.append(u\"\\\\000\")\n else:\n s.append(u\"\\\\\")\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L358_C20", "label": "append()", "type": "expression", "loc": [358, 358], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L357_C16", "vector": [8, 5, 0.5092, 0.0014, 5, 0.6, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L359_C16", "label": "if", "type": "if", "loc": [359, 363], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L357_C16", "vector": [4, 5, 0.5135, 0.0071, 5, 0.6, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif c == u\"\\x00\":\n s.append(u\"\\\\000\")\n else:\n s.append(u\"\\\\\")\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L360_C20", "label": "append()", "type": "expression", "loc": [360, 360], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L359_C16", "vector": [8, 6, 0.5121, 0.0014, 6, 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": " s.append(u\"\\\\000\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L362_C20", "label": "append()", "type": "expression", "loc": [362, 362], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L359_C16", "vector": [8, 6, 0.5149, 0.0014, 6, 0.58, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " s.append(u\"\\\\\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L363_C20", "label": "append()", "type": "expression", "loc": [363, 363], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L359_C16", "vector": [8, 6, 0.5164, 0.0014, 6, 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": " s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L365_C8", "label": "return", "type": "return", "loc": [365, 365], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L344_C4", "vector": [13, 2, 0.5192, 0.0014, 2, 0.95, 0.4, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return u\"\".join(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L367_C8", "label": "s =", "type": "assigned_variable", "loc": [367, 367], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L344_C4", "vector": [14, 2, 0.522, 0.0014, 2, 0.95, 0.6, 553, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L368_C8", "label": "if", "type": "if", "loc": [368, 385], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L344_C4", "vector": [4, 2, 0.5356, 0.0256, 2, 0.95, 0.8, 0, 2, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if special_only:\n for c in pattern:\n if c in _METACHARS:\n s.append(\"\\\\\")\n s.append(c)\n elif c == \"\\x00\":\n s.append(\"\\\\000\")\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L369_C12", "label": "for c", "type": "for", "loc": [369, 376], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L368_C8", "vector": [6, 3, 0.5299, 0.0114, 3, 0.14, 0.0, 411, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in pattern:\n if c in _METACHARS:\n s.append(\"\\\\\")\n s.append(c)\n elif c == \"\\x00\":\n s.append(\"\\\\000\")\n else:\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L370_C16", "label": "if", "type": "if", "loc": [370, 376], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L369_C12", "vector": [4, 4, 0.5306, 0.01, 4, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if c in _METACHARS:\n s.append(\"\\\\\")\n s.append(c)\n elif c == \"\\x00\":\n s.append(\"\\\\000\")\n else:\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L371_C20", "label": "append()", "type": "expression", "loc": [371, 371], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L370_C16", "vector": [8, 5, 0.5277, 0.0014, 5, 0.45, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " s.append(\"\\\\\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L372_C20", "label": "append()", "type": "expression", "loc": [372, 372], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L370_C16", "vector": [8, 5, 0.5292, 0.0014, 5, 0.45, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L373_C16", "label": "if", "type": "if", "loc": [373, 376], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L370_C16", "vector": [4, 5, 0.5327, 0.0057, 5, 0.45, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif c == \"\\x00\":\n s.append(\"\\\\000\")\n else:\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L374_C20", "label": "append()", "type": "expression", "loc": [374, 374], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L373_C16", "vector": [8, 6, 0.532, 0.0014, 6, 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": " s.append(\"\\\\000\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L376_C20", "label": "append()", "type": "expression", "loc": [376, 376], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L373_C16", "vector": [8, 6, 0.5349, 0.0014, 6, 0.24, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L378_C12", "label": "for c", "type": "for", "loc": [378, 385], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L368_C8", "vector": [6, 3, 0.5427, 0.0114, 3, 0.14, 1.0, 411, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in pattern:\n if c in _ALNUM:\n s.append(c)\n elif c == \"\\x00\":\n s.append(\"\\\\000\")\n else:\n s.append(\"\\\\\")\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L379_C16", "label": "if", "type": "if", "loc": [379, 385], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L378_C12", "vector": [4, 4, 0.5434, 0.01, 4, 0.11, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if c in _ALNUM:\n s.append(c)\n elif c == \"\\x00\":\n s.append(\"\\\\000\")\n else:\n s.append(\"\\\\\")\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L380_C20", "label": "append()", "type": "expression", "loc": [380, 380], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L379_C16", "vector": [8, 5, 0.5405, 0.0014, 5, 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": " s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L381_C16", "label": "if", "type": "if", "loc": [381, 385], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L379_C16", "vector": [4, 5, 0.5448, 0.0071, 5, 0.92, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif c == \"\\x00\":\n s.append(\"\\\\000\")\n else:\n s.append(\"\\\\\")\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L382_C20", "label": "append()", "type": "expression", "loc": [382, 382], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L381_C16", "vector": [8, 6, 0.5434, 0.0014, 6, 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": " s.append(\"\\\\000\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L384_C20", "label": "append()", "type": "expression", "loc": [384, 384], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L381_C16", "vector": [8, 6, 0.5462, 0.0014, 6, 0.81, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " s.append(\"\\\\\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L385_C20", "label": "append()", "type": "expression", "loc": [385, 385], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L381_C16", "vector": [8, 6, 0.5477, 0.0014, 6, 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": " s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L387_C8", "label": "return", "type": "return", "loc": [387, 387], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L344_C4", "vector": [13, 2, 0.5505, 0.0014, 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 \"\".join(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Import_L392_C0", "label": "_regex_core import _regex_core", "type": "import", "loc": [392, 392], "level": 0, "parent": null, "vector": [1, 0, 0.5576, 0.0014, 0, 0.66, 0.4286, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "_regex_core", "arg_names": [], "import_names": ["_regex_core"], "rhs_call_name": "", "annotation": ""}, "snippet": "import _regex_core"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Import_L393_C0", "label": "_regex import _regex", "type": "import", "loc": [393, 393], "level": 0, "parent": null, "vector": [1, 0, 0.559, 0.0014, 0, 0.66, 0.4524, 136, 0, 1, 0, 0, 136, 0, 0], "semantic": {"name": "_regex", "arg_names": [], "import_names": ["_regex"], "rhs_call_name": "", "annotation": ""}, "snippet": "import _regex"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:ImportFrom_L394_C0", "label": "from threading import _RLock", "type": "import", "loc": [394, 394], "level": 0, "parent": null, "vector": [1, 0, 0.5605, 0.0014, 0, 0.66, 0.4762, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["_RLock"], "rhs_call_name": "", "annotation": ""}, "snippet": "from threading import RLock as _RLock"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:ImportFrom_L395_C0", "label": "from locale import _getlocale", "type": "import", "loc": [395, 395], "level": 0, "parent": null, "vector": [1, 0, 0.5619, 0.0014, 0, 0.66, 0.5, 884, 0, 1, 0, 0, 884, 0, 0], "semantic": {"name": "locale", "arg_names": [], "import_names": ["_getlocale"], "rhs_call_name": "", "annotation": ""}, "snippet": "from locale import getlocale as _getlocale"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:ImportFrom_L396_C0", "label": "from _regex_core import *", "type": "import", "loc": [396, 396], "level": 0, "parent": null, "vector": [1, 0, 0.5633, 0.0014, 0, 0.66, 0.5238, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "_regex_core", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from _regex_core import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:ImportFrom_L397_C0", "label": "from _regex_core import _ALL_VERSIONS, _ALL_ENCODINGS, _FirstSetError\u2026", "type": "import", "loc": [397, 400], "level": 0, "parent": null, "vector": [1, 0, 0.5669, 0.0057, 0, 0.66, 0.5476, 944, 0, 12, 0, 0, 944, 0, 0], "semantic": {"name": "_regex_core", "arg_names": [], "import_names": ["_ALL_VERSIONS", "_ALL_ENCODINGS", "_FirstSetError", "_UnscopedFlagSet", "_check_group_features", "_compile_firstset", "_compile_replacement", "_flatten_code", "_fold_case", "_get_required_string", "_parse_pattern", "_shrink_cache"], "rhs_call_name": "", "annotation": ""}, "snippet": "from _regex_core import (_ALL_VERSIONS, _ALL_ENCODINGS, _FirstSetError,\n _UnscopedFlagSet, _check_group_features, _compile_firstset,\n _compile_replacement, _flatten_code, _fold_case, _get_required_string,\n _parse_pattern, _shrink_cache)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:ImportFrom_L401_C0", "label": "from _regex_core import _ALNUM, _Info, _OP\u2026", "type": "import", "loc": [401, 402], "level": 0, "parent": null, "vector": [1, 0, 0.5711, 0.0028, 0, 0.66, 0.5714, 944, 0, 5, 0, 0, 944, 0, 0], "semantic": {"name": "_regex_core", "arg_names": [], "import_names": ["_ALNUM", "_Info", "_OP", "_Source", "_Fuzzy"], "rhs_call_name": "", "annotation": ""}, "snippet": "from _regex_core import (ALNUM as _ALNUM, Info as _Info, OP as _OP, Source as\n _Source, Fuzzy as _Fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L407_C0", "label": "DEFAULT_VERSION =", "type": "assigned_variable", "loc": [407, 407], "level": 0, "parent": null, "vector": [14, 0, 0.5789, 0.0014, 0, 0.66, 0.5952, 455, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "DEFAULT_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEFAULT_VERSION = VERSION0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L409_C0", "label": "_METACHARS = frozenset()", "type": "assigned_variable", "loc": [409, 409], "level": 0, "parent": null, "vector": [14, 0, 0.5818, 0.0014, 0, 0.66, 0.619, 45, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "_METACHARS", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": "_METACHARS = frozenset(\"()[]{}?*+|^$\\\\.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L411_C0", "label": "_regex_core.DEFAULT_VERSION =", "type": "assigned_variable", "loc": [411, 411], "level": 0, "parent": null, "vector": [14, 0, 0.5846, 0.0014, 0, 0.66, 0.6429, 276, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_regex_core.DEFAULT_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_regex_core.DEFAULT_VERSION = DEFAULT_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L414_C0", "label": "_cache =", "type": "assigned_variable", "loc": [414, 414], "level": 0, "parent": null, "vector": [14, 0, 0.5889, 0.0014, 0, 0.66, 0.6667, 123, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_cache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_cache = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L415_C0", "label": "_cache_lock = _RLock()", "type": "assigned_variable", "loc": [415, 415], "level": 0, "parent": null, "vector": [14, 0, 0.5903, 0.0014, 0, 0.66, 0.6905, 397, 3, 0, 0, 0, 74, 10, 1], "semantic": {"name": "_cache_lock", "arg_names": [], "import_names": [], "rhs_call_name": "_RLock", "annotation": ""}, "snippet": "_cache_lock = _RLock()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L416_C0", "label": "_named_args =", "type": "assigned_variable", "loc": [416, 416], "level": 0, "parent": null, "vector": [14, 0, 0.5917, 0.0014, 0, 0.66, 0.7143, 36, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_named_args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_named_args = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L417_C0", "label": "_replacement_cache =", "type": "assigned_variable", "loc": [417, 417], "level": 0, "parent": null, "vector": [14, 0, 0.5932, 0.0014, 0, 0.66, 0.7381, 47, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_replacement_cache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_replacement_cache = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L418_C0", "label": "_locale_sensitive =", "type": "assigned_variable", "loc": [418, 418], "level": 0, "parent": null, "vector": [14, 0, 0.5946, 0.0014, 0, 0.66, 0.7619, 770, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_locale_sensitive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_locale_sensitive = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L421_C0", "label": "_MAXCACHE =", "type": "assigned_variable", "loc": [421, 421], "level": 0, "parent": null, "vector": [14, 0, 0.5989, 0.0014, 0, 0.66, 0.7857, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "_MAXCACHE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_MAXCACHE = 500"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L422_C0", "label": "_MAXREPCACHE =", "type": "assigned_variable", "loc": [422, 422], "level": 0, "parent": null, "vector": [14, 0, 0.6003, 0.0014, 0, 0.66, 0.8095, 254, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "_MAXREPCACHE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_MAXREPCACHE = 500"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "label": "_compile", "type": "function", "loc": [424, 617], "level": 0, "parent": null, "vector": [2, 0, 0.7404, 0.276, 0, 0.66, 0.8333, 779, 0, 3, 1, 0, 0, 0, 58], "semantic": {"name": "_compile", "arg_names": ["pattern", "flags", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _compile(pattern, flags=0, kwargs={}):\n \"Compiles a regular expression to a PatternObject.\"\n\n # We won't bother to cache the pattern if we're debugging.\n debugging = (flags & DEBUG) != 0\n\n # What locale is this pattern using?\n locale_key = (type(pattern), pattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L425_C4", "label": "expression", "type": "expression", "loc": [425, 425], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [8, 1, 0.6046, 0.0014, 1, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Compiles a regular expression to a PatternObject.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L428_C4", "label": "debugging =", "type": "assigned_variable", "loc": [428, 428], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.6088, 0.0014, 1, 0.66, 0.0256, 716, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "debugging", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " debugging = (flags & DEBUG) != 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L431_C4", "label": "locale_key =", "type": "assigned_variable", "loc": [431, 431], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.6131, 0.0014, 1, 0.66, 0.0513, 400, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "locale_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " locale_key = (type(pattern), pattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L432_C4", "label": "if", "type": "if", "loc": [432, 437], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [4, 1, 0.6181, 0.0085, 1, 0.66, 0.0769, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _locale_sensitive.get(locale_key, True) or (flags & LOCALE) != 0:\n # This pattern is, or might be, locale-sensitive.\n pattern_locale = _getlocale()[1]\n else:\n # This pattern is definitely not locale-sensitive.\n pattern_locale = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L434_C8", "label": "pattern_locale =", "type": "assigned_variable", "loc": [434, 434], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L432_C4", "vector": [14, 2, 0.6174, 0.0014, 2, 0.8, 0.0, 15, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pattern_locale", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pattern_locale = _getlocale()[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L437_C8", "label": "pattern_locale =", "type": "assigned_variable", "loc": [437, 437], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L432_C4", "vector": [14, 2, 0.6216, 0.0014, 2, 0.8, 1.0, 15, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "pattern_locale", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pattern_locale = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L439_C4", "label": "if", "type": "if", "loc": [439, 462], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [4, 1, 0.6408, 0.0341, 1, 0.66, 0.1026, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not debugging:\n try:\n # Do we know what keyword arguments are needed?\n args_key = pattern, type(pattern), flags\n args_needed = _named_args[args_key]\n\n # Are we being provided with its required keyword arguments?\n args_supplied = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L440_C8", "label": "try", "type": "try", "loc": [440, 462], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L439_C4", "vector": [7, 2, 0.6415, 0.0327, 2, 0.78, 0.0, 0, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # Do we know what keyword arguments are needed?\n args_key = pattern, type(pattern), flags\n args_needed = _named_args[args_key]\n\n # Are we being provided with its required keyword arguments?\n args_supplied = set()\n if args_needed:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L442_C12", "label": "args_key =", "type": "assigned_variable", "loc": [442, 442], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L440_C8", "vector": [14, 3, 0.6287, 0.0014, 3, 0.88, 0.0, 273, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "args_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args_key = pattern, type(pattern), flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L443_C12", "label": "args_needed =", "type": "assigned_variable", "loc": [443, 443], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L440_C8", "vector": [14, 3, 0.6302, 0.0014, 3, 0.88, 0.1667, 715, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "args_needed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args_needed = _named_args[args_key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L446_C12", "label": "args_supplied = set()", "type": "assigned_variable", "loc": [446, 446], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L440_C8", "vector": [14, 3, 0.6344, 0.0014, 3, 0.88, 0.3333, 327, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "args_supplied", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " args_supplied = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L447_C12", "label": "if", "type": "if", "loc": [447, 452], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L440_C8", "vector": [4, 3, 0.6394, 0.0085, 3, 0.88, 0.5, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args_needed:\n for k, v in args_needed:\n try:\n args_supplied.add((k, frozenset(kwargs[k])))\n except KeyError:\n raise error(\"missing named list: {!r}\".format(k))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L448_C16", "label": "for k, v", "type": "for", "loc": [448, 452], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L447_C12", "vector": [6, 4, 0.6401, 0.0071, 4, 0.67, 0.0, 867, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in args_needed:\n try:\n args_supplied.add((k, frozenset(kwargs[k])))\n except KeyError:\n raise error(\"missing named list: {!r}\".format(k))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L449_C20", "label": "try", "type": "try", "loc": [449, 452], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L448_C16", "vector": [7, 5, 0.6408, 0.0057, 5, 0.35, 0.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n args_supplied.add((k, frozenset(kwargs[k])))\n except KeyError:\n raise error(\"missing named list: {!r}\".format(k))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L450_C24", "label": "add()", "type": "expression", "loc": [450, 450], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L449_C20", "vector": [8, 6, 0.6401, 0.0014, 6, 0.92, 0.0, 241, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " args_supplied.add((k, frozenset(kwargs[k])))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L454_C12", "label": "args_supplied = frozenset()", "type": "assigned_variable", "loc": [454, 454], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L440_C8", "vector": [14, 3, 0.6458, 0.0014, 3, 0.88, 0.6667, 327, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "args_supplied", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": " args_supplied = frozenset(args_supplied)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L457_C12", "label": "pattern_key =", "type": "assigned_variable", "loc": [457, 458], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L440_C8", "vector": [14, 3, 0.6508, 0.0028, 3, 0.88, 0.8333, 383, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "pattern_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pattern_key = (pattern, type(pattern), flags, args_supplied,\n DEFAULT_VERSION, pattern_locale)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L459_C12", "label": "return", "type": "return", "loc": [459, 459], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L440_C8", "vector": [13, 3, 0.6529, 0.0014, 3, 0.88, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _cache[pattern_key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L465_C4", "label": "if", "type": "if", "loc": [465, 475], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [4, 1, 0.6686, 0.0156, 1, 0.66, 0.1282, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(pattern, unicode):\n guess_encoding = UNICODE\n elif isinstance(pattern, str):\n guess_encoding = ASCII\n elif isinstance(pattern, _pattern_type):\n if flags:\n raise ValueError(\"cannot process flags argument with a compiled pattern\")\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L466_C8", "label": "guess_encoding =", "type": "assigned_variable", "loc": [466, 466], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L465_C4", "vector": [14, 2, 0.6629, 0.0014, 2, 0.97, 0.0, 979, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "guess_encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " guess_encoding = UNICODE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L467_C4", "label": "if", "type": "if", "loc": [467, 475], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L465_C4", "vector": [4, 2, 0.67, 0.0128, 2, 0.97, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(pattern, str):\n guess_encoding = ASCII\n elif isinstance(pattern, _pattern_type):\n if flags:\n raise ValueError(\"cannot process flags argument with a compiled pattern\")\n\n return pattern\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L468_C8", "label": "guess_encoding =", "type": "assigned_variable", "loc": [468, 468], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L467_C4", "vector": [14, 3, 0.6657, 0.0014, 3, 0.53, 0.0, 979, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "guess_encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " guess_encoding = ASCII"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L469_C4", "label": "if", "type": "if", "loc": [469, 475], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L467_C4", "vector": [4, 3, 0.6714, 0.01, 3, 0.53, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(pattern, _pattern_type):\n if flags:\n raise ValueError(\"cannot process flags argument with a compiled pattern\")\n\n return pattern\n else:\n raise TypeError(\"first argument must be a string or compiled pattern\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L470_C8", "label": "if", "type": "if", "loc": [470, 471], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L469_C4", "vector": [4, 4, 0.6693, 0.0028, 4, 0.54, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if flags:\n raise ValueError(\"cannot process flags argument with a compiled pattern\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L473_C8", "label": "return", "type": "return", "loc": [473, 473], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L469_C4", "vector": [13, 4, 0.6728, 0.0014, 4, 0.54, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return pattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L478_C4", "label": "_regex_core.DEFAULT_VERSION =", "type": "assigned_variable", "loc": [478, 478], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.6799, 0.0014, 1, 0.66, 0.1538, 276, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_regex_core.DEFAULT_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _regex_core.DEFAULT_VERSION = DEFAULT_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L480_C4", "label": "caught_exception =", "type": "assigned_variable", "loc": [480, 480], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.6828, 0.0014, 1, 0.66, 0.1795, 573, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "caught_exception", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " caught_exception = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L481_C4", "label": "global_flags =", "type": "assigned_variable", "loc": [481, 481], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.6842, 0.0014, 1, 0.66, 0.2051, 679, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "global_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " global_flags = flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L483_C4", "label": "while", "type": "while", "loc": [483, 498], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [5, 1, 0.6977, 0.0228, 1, 0.66, 0.2308, 0, 1, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n try:\n source = _Source(pattern)\n info = _Info(global_flags, source.char_type, kwargs)\n info.guess_encoding = guess_encoding\n source.ignore_space = bool(info.flags & VERBOSE)\n parsed = _parse_pattern(source, info)\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L484_C8", "label": "try", "type": "try", "loc": [484, 494], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L483_C4", "vector": [7, 2, 0.6956, 0.0156, 2, 0.67, 0.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n source = _Source(pattern)\n info = _Info(global_flags, source.char_type, kwargs)\n info.guess_encoding = guess_encoding\n source.ignore_space = bool(info.flags & VERBOSE)\n parsed = _parse_pattern(source, info)\n break\n except _UnscopedFlagSet:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L485_C12", "label": "source = _Source()", "type": "assigned_variable", "loc": [485, 485], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L484_C8", "vector": [14, 3, 0.6899, 0.0014, 3, 0.77, 0.0, 703, 3, 1, 0, 0, 566, 10, 1], "semantic": {"name": "source", "arg_names": [], "import_names": [], "rhs_call_name": "_Source", "annotation": ""}, "snippet": " source = _Source(pattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L486_C12", "label": "info = _Info()", "type": "assigned_variable", "loc": [486, 486], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L484_C8", "vector": [14, 3, 0.6913, 0.0014, 3, 0.77, 0.25, 730, 3, 3, 0, 0, 287, 10, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "_Info", "annotation": ""}, "snippet": " info = _Info(global_flags, source.char_type, kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L487_C12", "label": "info.guess_encoding =", "type": "assigned_variable", "loc": [487, 487], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L484_C8", "vector": [14, 3, 0.6927, 0.0014, 3, 0.77, 0.5, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "info.guess_encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " info.guess_encoding = guess_encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L488_C12", "label": "source.ignore_space = bool()", "type": "assigned_variable", "loc": [488, 488], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L484_C8", "vector": [14, 3, 0.6942, 0.0014, 3, 0.77, 0.75, 890, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "source.ignore_space", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " source.ignore_space = bool(info.flags & VERBOSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L489_C12", "label": "parsed = _parse_pattern()", "type": "assigned_variable", "loc": [489, 489], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L484_C8", "vector": [14, 3, 0.6956, 0.0014, 3, 0.77, 1.0, 313, 3, 2, 0, 0, 68, 10, 1], "semantic": {"name": "parsed", "arg_names": [], "import_names": [], "rhs_call_name": "_parse_pattern", "annotation": ""}, "snippet": " parsed = _parse_pattern(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L493_C12", "label": "global_flags =", "type": "assigned_variable", "loc": [493, 493], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L484_C8", "vector": [14, 3, 0.7013, 0.0014, 3, 0.77, 0.0, 679, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "global_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " global_flags = info.global_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L494_C12", "label": "caught_exception =", "type": "assigned_variable", "loc": [494, 494], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L484_C8", "vector": [14, 3, 0.7027, 0.0014, 3, 0.77, 1.0, 573, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "caught_exception", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " caught_exception = e"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L496_C8", "label": "if", "type": "if", "loc": [496, 498], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L483_C4", "vector": [4, 2, 0.707, 0.0043, 2, 0.67, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if caught_exception:\n raise error(caught_exception.msg, caught_exception.pattern,\n caught_exception.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L500_C4", "label": "if", "type": "if", "loc": [500, 501], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [4, 1, 0.7119, 0.0028, 1, 0.66, 0.2564, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not source.at_end():\n raise error(\"trailing characters in pattern\", pattern, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L504_C4", "label": "version =", "type": "assigned_variable", "loc": [504, 504], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.7169, 0.0014, 1, 0.66, 0.2821, 623, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L505_C4", "label": "if", "type": "if", "loc": [505, 506], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [4, 1, 0.7191, 0.0028, 1, 0.66, 0.3077, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version not in (0, VERSION0, VERSION1):\n raise ValueError(\"VERSION0 and VERSION1 flags are mutually incompatible\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L508_C4", "label": "if", "type": "if", "loc": [508, 509], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [4, 1, 0.7233, 0.0028, 1, 0.66, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (info.flags & _ALL_ENCODINGS) not in (0, ASCII, LOCALE, UNICODE):\n raise ValueError(\"ASCII, LOCALE and UNICODE flags are mutually incompatible\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L511_C4", "label": "if", "type": "if", "loc": [511, 515], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [4, 1, 0.7297, 0.0071, 1, 0.66, 0.359, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not (info.flags & _ALL_ENCODINGS):\n if isinstance(pattern, unicode):\n info.flags |= UNICODE\n else:\n info.flags |= ASCII"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L512_C8", "label": "if", "type": "if", "loc": [512, 515], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L511_C4", "vector": [4, 2, 0.7304, 0.0057, 2, 0.87, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(pattern, unicode):\n info.flags |= UNICODE\n else:\n info.flags |= ASCII"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L517_C4", "label": "reverse = bool()", "type": "assigned_variable", "loc": [517, 517], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.7354, 0.0014, 1, 0.66, 0.3846, 109, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "reverse", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " reverse = bool(info.flags & REVERSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L518_C4", "label": "fuzzy = isinstance()", "type": "assigned_variable", "loc": [518, 518], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.7368, 0.0014, 1, 0.66, 0.4103, 20, 3, 2, 0, 0, 552, 10, 1], "semantic": {"name": "fuzzy", "arg_names": [], "import_names": [], "rhs_call_name": "isinstance", "annotation": ""}, "snippet": " fuzzy = isinstance(parsed, _Fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L521_C4", "label": "assign", "type": "assigned_variable", "loc": [521, 521], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.7411, 0.0014, 1, 0.66, 0.4359, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _locale_sensitive[locale_key] = info.inline_locale"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L524_C4", "label": "if", "type": "if", "loc": [524, 525], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [4, 1, 0.7461, 0.0028, 1, 0.66, 0.4615, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if flags & DEBUG:\n parsed.dump(indent=0, reverse=reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L525_C8", "label": "dump()", "type": "expression", "loc": [525, 525], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L524_C4", "vector": [8, 2, 0.7468, 0.0014, 2, 0.49, 0.0, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " parsed.dump(indent=0, reverse=reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L528_C4", "label": "fix_groups()", "type": "expression", "loc": [528, 528], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [8, 1, 0.7511, 0.0014, 1, 0.66, 0.4872, 269, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "fix_groups", "arg_names": [], "import_names": [], "rhs_call_name": "fix_groups", "annotation": ""}, "snippet": " parsed.fix_groups(pattern, reverse, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L531_C4", "label": "parsed = optimise()", "type": "assigned_variable", "loc": [531, 531], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.7553, 0.0014, 1, 0.66, 0.5128, 313, 3, 1, 0, 0, 265, 10, 1], "semantic": {"name": "parsed", "arg_names": [], "import_names": [], "rhs_call_name": "optimise", "annotation": ""}, "snippet": " parsed = parsed.optimise(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L532_C4", "label": "parsed = pack_characters()", "type": "assigned_variable", "loc": [532, 532], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.7568, 0.0014, 1, 0.66, 0.5385, 313, 3, 1, 0, 0, 434, 10, 1], "semantic": {"name": "parsed", "arg_names": [], "import_names": [], "rhs_call_name": "pack_characters", "annotation": ""}, "snippet": " parsed = parsed.pack_characters(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L535_C4", "label": "req_offset, req_chars, req_flags = _get_required_string()", "type": "assigned_variable", "loc": [535, 535], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.761, 0.0014, 1, 0.66, 0.5641, 98, 3, 2, 0, 0, 809, 10, 1], "semantic": {"name": "req_offset, req_chars, req_flags", "arg_names": [], "import_names": [], "rhs_call_name": "_get_required_string", "annotation": ""}, "snippet": " req_offset, req_chars, req_flags = _get_required_string(parsed, info.flags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L538_C4", "label": "named_lists =", "type": "assigned_variable", "loc": [538, 538], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.7653, 0.0014, 1, 0.66, 0.5897, 423, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "named_lists", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " named_lists = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L539_C4", "label": "named_list_indexes =", "type": "assigned_variable", "loc": [539, 539], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.7667, 0.0014, 1, 0.66, 0.6154, 824, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "named_list_indexes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " named_list_indexes = [None] * len(info.named_lists_used)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L540_C4", "label": "args_needed = set()", "type": "assigned_variable", "loc": [540, 540], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.7681, 0.0014, 1, 0.66, 0.641, 715, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "args_needed", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " args_needed = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L541_C4", "label": "for key, index", "type": "for", "loc": [541, 550], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [6, 1, 0.776, 0.0142, 1, 0.66, 0.6667, 763, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "key, index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, index in info.named_lists_used.items():\n name, case_flags = key\n values = frozenset(kwargs[name])\n if case_flags:\n items = frozenset(_fold_case(info, v) for v in values)\n else:\n items = values\n named_lists[name] = values"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L542_C8", "label": "name, case_flags =", "type": "assigned_variable", "loc": [542, 542], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L541_C4", "vector": [14, 2, 0.771, 0.0014, 2, 0.68, 0.0, 34, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name, case_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name, case_flags = key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L543_C8", "label": "values = frozenset()", "type": "assigned_variable", "loc": [543, 543], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L541_C4", "vector": [14, 2, 0.7724, 0.0014, 2, 0.68, 0.2, 721, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "values", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": " values = frozenset(kwargs[name])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L544_C8", "label": "if", "type": "if", "loc": [544, 547], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L541_C4", "vector": [4, 2, 0.776, 0.0057, 2, 0.68, 0.4, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if case_flags:\n items = frozenset(_fold_case(info, v) for v in values)\n else:\n items = values"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L545_C12", "label": "items = frozenset()", "type": "assigned_variable", "loc": [545, 545], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L544_C8", "vector": [14, 3, 0.7752, 0.0014, 3, 0.37, 0.0, 339, 3, 1, 0, 0, 80, 10, 2], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": " items = frozenset(_fold_case(info, v) for v in values)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L547_C12", "label": "items =", "type": "assigned_variable", "loc": [547, 547], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L544_C8", "vector": [14, 3, 0.7781, 0.0014, 3, 0.37, 1.0, 339, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = values"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L548_C8", "label": "assign", "type": "assigned_variable", "loc": [548, 548], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L541_C4", "vector": [14, 2, 0.7795, 0.0014, 2, 0.68, 0.6, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " named_lists[name] = values"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L549_C8", "label": "assign", "type": "assigned_variable", "loc": [549, 549], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L541_C4", "vector": [14, 2, 0.7809, 0.0014, 2, 0.68, 0.8, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " named_list_indexes[index] = items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L550_C8", "label": "add()", "type": "expression", "loc": [550, 550], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L541_C4", "vector": [8, 2, 0.7824, 0.0014, 2, 0.68, 1.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " args_needed.add((name, values))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L553_C4", "label": "_check_group_features()", "type": "expression", "loc": [553, 553], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [8, 1, 0.7866, 0.0014, 1, 0.66, 0.6923, 534, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_check_group_features", "arg_names": [], "import_names": [], "rhs_call_name": "_check_group_features", "annotation": ""}, "snippet": " _check_group_features(info, parsed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L556_C4", "label": "code = compile()", "type": "assigned_variable", "loc": [556, 556], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.7909, 0.0014, 1, 0.66, 0.7179, 44, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " code = parsed.compile(reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L559_C4", "label": "key =", "type": "assigned_variable", "loc": [559, 559], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.7952, 0.0014, 1, 0.66, 0.7436, 230, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = (0, reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L560_C4", "label": "ref = get()", "type": "assigned_variable", "loc": [560, 560], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.7966, 0.0014, 1, 0.66, 0.7692, 686, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "ref", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ref = info.call_refs.get(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L561_C4", "label": "if", "type": "if", "loc": [561, 562], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [4, 1, 0.7987, 0.0028, 1, 0.66, 0.7949, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ref is not None:\n code = [(_OP.CALL_REF, ref)] + code + [(_OP.END, )]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L562_C8", "label": "code =", "type": "assigned_variable", "loc": [562, 562], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L561_C4", "vector": [14, 2, 0.7994, 0.0014, 2, 0.67, 0.0, 44, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " code = [(_OP.CALL_REF, ref)] + code + [(_OP.END, )]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L568_C4", "label": "for group, rev, fuz", "type": "for", "loc": [568, 569], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [6, 1, 0.8087, 0.0028, 1, 0.66, 0.8205, 648, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "group, rev, fuz", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for group, rev, fuz in info.additional_groups:\n code += group.compile(rev, fuz)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L572_C4", "label": "code = _flatten_code()", "type": "assigned_variable", "loc": [572, 572], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.8137, 0.0014, 1, 0.66, 0.8462, 44, 3, 1, 0, 0, 863, 10, 1], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "_flatten_code", "annotation": ""}, "snippet": " code = _flatten_code(code)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L574_C4", "label": "if", "type": "if", "loc": [574, 581], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [4, 1, 0.8215, 0.0114, 1, 0.66, 0.8718, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not parsed.has_simple_start():\n # Get the first set, if possible.\n try:\n fs_code = _compile_firstset(info, parsed.get_firstset(reverse))\n fs_code = _flatten_code(fs_code)\n code = fs_code + code\n except _FirstSetError:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L576_C8", "label": "try", "type": "try", "loc": [576, 581], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L574_C4", "vector": [7, 2, 0.8229, 0.0085, 2, 0.0, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n fs_code = _compile_firstset(info, parsed.get_firstset(reverse))\n fs_code = _flatten_code(fs_code)\n code = fs_code + code\n except _FirstSetError:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L577_C12", "label": "fs_code = _compile_firstset()", "type": "assigned_variable", "loc": [577, 577], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L576_C8", "vector": [14, 3, 0.8208, 0.0014, 3, 0.65, 0.0, 487, 3, 2, 0, 0, 346, 10, 2], "semantic": {"name": "fs_code", "arg_names": [], "import_names": [], "rhs_call_name": "_compile_firstset", "annotation": ""}, "snippet": " fs_code = _compile_firstset(info, parsed.get_firstset(reverse))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L578_C12", "label": "fs_code = _flatten_code()", "type": "assigned_variable", "loc": [578, 578], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L576_C8", "vector": [14, 3, 0.8222, 0.0014, 3, 0.65, 0.5, 487, 3, 1, 0, 0, 863, 10, 1], "semantic": {"name": "fs_code", "arg_names": [], "import_names": [], "rhs_call_name": "_flatten_code", "annotation": ""}, "snippet": " fs_code = _flatten_code(fs_code)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L579_C12", "label": "code =", "type": "assigned_variable", "loc": [579, 579], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L576_C8", "vector": [14, 3, 0.8236, 0.0014, 3, 0.65, 1.0, 44, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " code = fs_code + code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L584_C4", "label": "index_group = dict()", "type": "assigned_variable", "loc": [584, 584], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.8307, 0.0014, 1, 0.66, 0.8974, 833, 3, 1, 0, 0, 827, 10, 2], "semantic": {"name": "index_group", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " index_group = dict((v, n) for n, v in info.group_index.items())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L591_C4", "label": "compiled_pattern = compile()", "type": "assigned_variable", "loc": [591, 593], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [14, 1, 0.8421, 0.0043, 1, 0.66, 0.9231, 90, 3, 11, 0, 0, 821, 10, 1], "semantic": {"name": "compiled_pattern", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " compiled_pattern = _regex.compile(pattern, info.flags | version, code,\n info.group_index, index_group, named_lists, named_list_indexes,\n req_offset, req_chars, req_flags, info.group_count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L596_C4", "label": "if", "type": "if", "loc": [596, 601], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [4, 1, 0.8514, 0.0085, 1, 0.66, 0.9487, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(_cache) >= _MAXCACHE:\n _cache_lock.acquire()\n try:\n _shrink_cache(_cache, _named_args, _locale_sensitive, _MAXCACHE)\n finally:\n _cache_lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L597_C8", "label": "acquire()", "type": "expression", "loc": [597, 597], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L596_C4", "vector": [8, 2, 0.8492, 0.0014, 2, 0.4, 0.0, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " _cache_lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L598_C8", "label": "try", "type": "try", "loc": [598, 601], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L596_C4", "vector": [7, 2, 0.8528, 0.0057, 2, 0.4, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n _shrink_cache(_cache, _named_args, _locale_sensitive, _MAXCACHE)\n finally:\n _cache_lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L599_C12", "label": "_shrink_cache()", "type": "expression", "loc": [599, 599], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L598_C8", "vector": [8, 3, 0.8521, 0.0014, 3, 0.88, 0.0, 717, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "_shrink_cache", "arg_names": [], "import_names": [], "rhs_call_name": "_shrink_cache", "annotation": ""}, "snippet": " _shrink_cache(_cache, _named_args, _locale_sensitive, _MAXCACHE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L601_C12", "label": "release()", "type": "expression", "loc": [601, 601], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L598_C8", "vector": [8, 3, 0.8549, 0.0014, 3, 0.88, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " _cache_lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L603_C4", "label": "if", "type": "if", "loc": [603, 615], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [4, 1, 0.8663, 0.0185, 1, 0.66, 0.9744, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not debugging:\n if (info.flags & LOCALE) == 0:\n pattern_locale = None\n\n args_needed = frozenset(args_needed)\n\n # Store this regular expression and named list.\n pattern_key = (pattern, type(pattern), flags, args_needed,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L604_C8", "label": "if", "type": "if", "loc": [604, 605], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L603_C4", "vector": [4, 2, 0.8599, 0.0028, 2, 0.81, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (info.flags & LOCALE) == 0:\n pattern_locale = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L605_C12", "label": "pattern_locale =", "type": "assigned_variable", "loc": [605, 605], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L604_C8", "vector": [14, 3, 0.8606, 0.0014, 3, 0.42, 0.0, 15, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "pattern_locale", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pattern_locale = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L607_C8", "label": "args_needed = frozenset()", "type": "assigned_variable", "loc": [607, 607], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L603_C4", "vector": [14, 2, 0.8634, 0.0014, 2, 0.81, 0.25, 715, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "args_needed", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": " args_needed = frozenset(args_needed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L610_C8", "label": "pattern_key =", "type": "assigned_variable", "loc": [610, 611], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L603_C4", "vector": [14, 2, 0.8684, 0.0028, 2, 0.81, 0.5, 383, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "pattern_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pattern_key = (pattern, type(pattern), flags, args_needed,\n DEFAULT_VERSION, pattern_locale)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L612_C8", "label": "assign", "type": "assigned_variable", "loc": [612, 612], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L603_C4", "vector": [14, 2, 0.8706, 0.0014, 2, 0.81, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _cache[pattern_key] = compiled_pattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L615_C8", "label": "assign", "type": "assigned_variable", "loc": [615, 615], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L603_C4", "vector": [14, 2, 0.8748, 0.0014, 2, 0.81, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _named_args[args_key] = args_needed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L617_C4", "label": "return", "type": "return", "loc": [617, 617], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "vector": [13, 1, 0.8777, 0.0014, 1, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return compiled_pattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "label": "_compile_replacement_helper", "type": "function", "loc": [619, 669], "level": 0, "parent": null, "vector": [2, 0, 0.9161, 0.0725, 0, 0.66, 0.8571, 546, 0, 2, 1, 0, 0, 0, 19], "semantic": {"name": "_compile_replacement_helper", "arg_names": ["pattern", "template"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _compile_replacement_helper(pattern, template):\n \"Compiles a replacement template.\"\n # This function is called by the _regex module.\n\n # Have we seen this before?\n key = pattern.pattern, pattern.flags, template\n compiled = _replacement_cache.get(key)\n if compiled is not None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L620_C4", "label": "expression", "type": "expression", "loc": [620, 620], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "vector": [8, 1, 0.8819, 0.0014, 1, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Compiles a replacement template.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L624_C4", "label": "key =", "type": "assigned_variable", "loc": [624, 624], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "vector": [14, 1, 0.8876, 0.0014, 1, 0.25, 0.0769, 230, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = pattern.pattern, pattern.flags, template"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L625_C4", "label": "compiled = get()", "type": "assigned_variable", "loc": [625, 625], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "vector": [14, 1, 0.889, 0.0014, 1, 0.25, 0.1538, 71, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "compiled", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " compiled = _replacement_cache.get(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L626_C4", "label": "if", "type": "if", "loc": [626, 627], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "vector": [4, 1, 0.8912, 0.0028, 1, 0.25, 0.2308, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if compiled is not None:\n return compiled"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L627_C8", "label": "return", "type": "return", "loc": [627, 627], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L626_C4", "vector": [13, 2, 0.8919, 0.0014, 2, 0.73, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return compiled"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L629_C4", "label": "if", "type": "if", "loc": [629, 630], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "vector": [4, 1, 0.8954, 0.0028, 1, 0.25, 0.3077, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(_replacement_cache) >= _MAXREPCACHE:\n _replacement_cache.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L630_C8", "label": "clear()", "type": "expression", "loc": [630, 630], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L629_C4", "vector": [8, 2, 0.8962, 0.0014, 2, 0.67, 0.0, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " _replacement_cache.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L632_C4", "label": "is_unicode = isinstance()", "type": "assigned_variable", "loc": [632, 632], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "vector": [14, 1, 0.899, 0.0014, 1, 0.25, 0.3846, 445, 3, 2, 0, 0, 552, 10, 1], "semantic": {"name": "is_unicode", "arg_names": [], "import_names": [], "rhs_call_name": "isinstance", "annotation": ""}, "snippet": " is_unicode = isinstance(template, unicode)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L633_C4", "label": "source = _Source()", "type": "assigned_variable", "loc": [633, 633], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "vector": [14, 1, 0.9004, 0.0014, 1, 0.25, 0.4615, 703, 3, 1, 0, 0, 566, 10, 1], "semantic": {"name": "source", "arg_names": [], "import_names": [], "rhs_call_name": "_Source", "annotation": ""}, "snippet": " source = _Source(template)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L634_C4", "label": "if", "type": "if", "loc": [634, 639], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "vector": [4, 1, 0.9054, 0.0085, 1, 0.25, 0.5385, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if is_unicode:\n def make_string(char_codes):\n return u\"\".join(unichr(c) for c in char_codes)\n else:\n def make_string(char_codes):\n return \"\".join(chr(c) for c in char_codes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L635_C8", "label": "make_string", "type": "function", "loc": [635, 636], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L634_C4", "vector": [2, 2, 0.904, 0.0028, 2, 0.98, 0.0, 714, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "make_string", "arg_names": ["char_codes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def make_string(char_codes):\n return u\"\".join(unichr(c) for c in char_codes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L636_C12", "label": "return", "type": "return", "loc": [636, 636], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L635_C8", "vector": [13, 3, 0.9047, 0.0014, 3, 0.37, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return u\"\".join(unichr(c) for c in char_codes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L638_C8", "label": "make_string", "type": "function", "loc": [638, 639], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L634_C4", "vector": [2, 2, 0.9083, 0.0028, 2, 0.98, 1.0, 714, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "make_string", "arg_names": ["char_codes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def make_string(char_codes):\n return \"\".join(chr(c) for c in char_codes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L639_C12", "label": "return", "type": "return", "loc": [639, 639], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L638_C8", "vector": [13, 3, 0.909, 0.0014, 3, 0.54, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"\".join(chr(c) for c in char_codes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L641_C4", "label": "compiled =", "type": "assigned_variable", "loc": [641, 641], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "vector": [14, 1, 0.9118, 0.0014, 1, 0.25, 0.6154, 71, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "compiled", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " compiled = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L642_C4", "label": "literal =", "type": "assigned_variable", "loc": [642, 642], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "vector": [14, 1, 0.9132, 0.0014, 1, 0.25, 0.6923, 874, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "literal", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " literal = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L643_C4", "label": "while", "type": "while", "loc": [643, 661], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "vector": [5, 1, 0.9275, 0.027, 1, 0.25, 0.7692, 0, 1, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n ch = source.get()\n if not ch:\n break\n if ch == \"\\\\\":\n # '_compile_replacement' will return either an int group reference\n # or a string literal. It returns items (plural) in order to handle\n # a 2-character literal (an invalid escape sequence)."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L644_C8", "label": "ch = get()", "type": "assigned_variable", "loc": [644, 644], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L643_C4", "vector": [14, 2, 0.9161, 0.0014, 2, 0.68, 0.0, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L645_C8", "label": "if", "type": "if", "loc": [645, 646], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L643_C4", "vector": [4, 2, 0.9182, 0.0028, 2, 0.68, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not ch:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L647_C8", "label": "if", "type": "if", "loc": [647, 661], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L643_C4", "vector": [4, 2, 0.9303, 0.0213, 2, 0.68, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"\\\\\":\n # '_compile_replacement' will return either an int group reference\n # or a string literal. It returns items (plural) in order to handle\n # a 2-character literal (an invalid escape sequence).\n is_group, items = _compile_replacement(source, pattern, is_unicode)\n if is_group:\n # It's a group, so first flush the literal.\n if literal:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L651_C12", "label": "is_group, items = _compile_replacement()", "type": "assigned_variable", "loc": [651, 651], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L647_C8", "vector": [14, 3, 0.926, 0.0014, 3, 0.03, 0.0, 654, 3, 3, 0, 0, 693, 10, 1], "semantic": {"name": "is_group, items", "arg_names": [], "import_names": [], "rhs_call_name": "_compile_replacement", "annotation": ""}, "snippet": " is_group, items = _compile_replacement(source, pattern, is_unicode)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L652_C12", "label": "if", "type": "if", "loc": [652, 659], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L647_C8", "vector": [4, 3, 0.9324, 0.0114, 3, 0.03, 0.5, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if is_group:\n # It's a group, so first flush the literal.\n if literal:\n compiled.append(make_string(literal))\n literal = []\n compiled.extend(items)\n else:\n literal.extend(items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L654_C16", "label": "if", "type": "if", "loc": [654, 656], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L652_C12", "vector": [4, 4, 0.9317, 0.0043, 4, 0.81, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if literal:\n compiled.append(make_string(literal))\n literal = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L655_C20", "label": "append()", "type": "expression", "loc": [655, 655], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L654_C16", "vector": [8, 5, 0.9317, 0.0014, 5, 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": " compiled.append(make_string(literal))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L656_C20", "label": "literal =", "type": "assigned_variable", "loc": [656, 656], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L654_C16", "vector": [14, 5, 0.9331, 0.0014, 5, 0.46, 1.0, 874, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "literal", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " literal = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L657_C16", "label": "extend()", "type": "expression", "loc": [657, 657], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L652_C12", "vector": [8, 4, 0.9346, 0.0014, 4, 0.81, 0.5, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " compiled.extend(items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L659_C16", "label": "extend()", "type": "expression", "loc": [659, 659], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L652_C12", "vector": [8, 4, 0.9374, 0.0014, 4, 0.81, 1.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " literal.extend(items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L661_C12", "label": "append()", "type": "expression", "loc": [661, 661], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L647_C8", "vector": [8, 3, 0.9403, 0.0014, 3, 0.03, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " literal.append(ord(ch))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L664_C4", "label": "if", "type": "if", "loc": [664, 665], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "vector": [4, 1, 0.9452, 0.0028, 1, 0.25, 0.8462, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if literal:\n compiled.append(make_string(literal))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L665_C8", "label": "append()", "type": "expression", "loc": [665, 665], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L664_C4", "vector": [8, 2, 0.9459, 0.0014, 2, 0.11, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " compiled.append(make_string(literal))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L667_C4", "label": "assign", "type": "assigned_variable", "loc": [667, 667], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "vector": [14, 1, 0.9488, 0.0014, 1, 0.25, 0.9231, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _replacement_cache[key] = compiled"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L669_C4", "label": "return", "type": "return", "loc": [669, 669], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "vector": [13, 1, 0.9516, 0.0014, 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 compiled"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L672_C0", "label": "_pattern_type = type()", "type": "assigned_variable", "loc": [672, 672], "level": 0, "parent": null, "vector": [14, 0, 0.9559, 0.0014, 0, 0.66, 0.881, 891, 3, 1, 0, 0, 801, 10, 2], "semantic": {"name": "_pattern_type", "arg_names": [], "import_names": [], "rhs_call_name": "type", "annotation": ""}, "snippet": "_pattern_type = type(_compile(\"\", 0, {}))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L676_C0", "label": "Regex =", "type": "assigned_variable", "loc": [676, 676], "level": 0, "parent": null, "vector": [14, 0, 0.9616, 0.0014, 0, 0.66, 0.9048, 44, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Regex", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "Regex = compile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Import_L679_C0", "label": "copy_reg import _copy_reg", "type": "import", "loc": [679, 679], "level": 0, "parent": null, "vector": [1, 0, 0.9659, 0.0014, 0, 0.66, 0.9286, 527, 0, 1, 0, 0, 527, 0, 0], "semantic": {"name": "copy_reg", "arg_names": [], "import_names": ["_copy_reg"], "rhs_call_name": "", "annotation": ""}, "snippet": "import copy_reg as _copy_reg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L681_C0", "label": "_pickle", "type": "function", "loc": [681, 682], "level": 0, "parent": null, "vector": [2, 0, 0.9694, 0.0028, 0, 0.66, 0.9524, 925, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "_pickle", "arg_names": ["p"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _pickle(p):\n return _compile, (p.pattern, p.flags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L682_C4", "label": "return", "type": "return", "loc": [682, 682], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L681_C0", "vector": [13, 1, 0.9701, 0.0014, 1, 0.45, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile, (p.pattern, p.flags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L684_C0", "label": "pickle()", "type": "expression", "loc": [684, 684], "level": 0, "parent": null, "vector": [8, 0, 0.973, 0.0014, 0, 0.66, 0.9762, 848, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "pickle", "arg_names": [], "import_names": [], "rhs_call_name": "pickle", "annotation": ""}, "snippet": "_copy_reg.pickle(_pattern_type, _pickle, _compile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L686_C0", "label": "if", "type": "if", "loc": [686, 703], "level": 0, "parent": null, "vector": [4, 0, 0.9879, 0.0256, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if not hasattr(str, \"format\"):\n # Strings don't have the .format method (below Python 2.6).\n while True:\n _start = __doc__.find(\" subf\")\n if _start < 0:\n break\n\n _end = __doc__.find(\"\\n\", _start) + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L688_C4", "label": "while", "type": "while", "loc": [688, 697], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L686_C0", "vector": [5, 1, 0.9851, 0.0142, 1, 0.78, 0.0, 0, 1, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n _start = __doc__.find(\" subf\")\n if _start < 0:\n break\n\n _end = __doc__.find(\"\\n\", _start) + 1\n while __doc__.startswith(\" \", _end):\n _end = __doc__.find(\"\\n\", _end) + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L689_C8", "label": "_start = find()", "type": "assigned_variable", "loc": [689, 689], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L688_C4", "vector": [14, 2, 0.9801, 0.0014, 2, 0.84, 0.0, 212, 3, 1, 0, 0, 340, 10, 1], "semantic": {"name": "_start", "arg_names": [], "import_names": [], "rhs_call_name": "find", "annotation": ""}, "snippet": " _start = __doc__.find(\" subf\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L690_C8", "label": "if", "type": "if", "loc": [690, 691], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L688_C4", "vector": [4, 2, 0.9822, 0.0028, 2, 0.84, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _start < 0:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L693_C8", "label": "_end =", "type": "assigned_variable", "loc": [693, 693], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L688_C4", "vector": [14, 2, 0.9858, 0.0014, 2, 0.84, 0.5, 964, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _end = __doc__.find(\"\\n\", _start) + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L694_C8", "label": "while", "type": "while", "loc": [694, 695], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L688_C4", "vector": [5, 2, 0.9879, 0.0028, 2, 0.84, 0.75, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while __doc__.startswith(\" \", _end):\n _end = __doc__.find(\"\\n\", _end) + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L695_C12", "label": "_end =", "type": "assigned_variable", "loc": [695, 695], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L694_C8", "vector": [14, 3, 0.9886, 0.0014, 3, 0.18, 0.0, 964, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _end = __doc__.find(\"\\n\", _end) + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L697_C8", "label": "__doc__ =", "type": "assigned_variable", "loc": [697, 697], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L688_C4", "vector": [14, 2, 0.9915, 0.0014, 2, 0.84, 1.0, 155, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "__doc__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " __doc__ = __doc__[ : _start] + __doc__[_end : ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L699_C4", "label": "__all__ =", "type": "assigned_variable", "loc": [699, 699], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L686_C0", "vector": [14, 1, 0.9943, 0.0014, 1, 0.78, 1.0, 272, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " __all__ = [_name for _name in __all__ if not _name.startswith(\"subf\")]"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L233_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L235_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L233_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L237_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L240_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L242_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L240_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L249_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L251_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L254_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L256_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L254_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L261_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L266_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L271_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L274_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L276_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L274_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L283_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L286_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L288_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L286_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L298_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L299_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L298_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L305_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L309_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L312_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L314_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L312_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L318_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L321_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L323_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L321_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L326_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L329_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L330_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L329_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L331_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L333_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L333_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L335_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L333_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L336_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L339_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L340_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L342_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L343_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L342_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L344_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L344_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L345_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L344_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L346_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L346_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L347_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L347_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L348_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L348_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L349_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L348_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L350_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L348_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L351_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L351_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L352_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L351_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L354_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L346_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L356_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L356_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L357_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L357_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L358_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L357_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L359_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L359_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L360_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L359_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L362_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L359_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L363_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L344_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L365_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L344_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L367_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L344_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L368_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L368_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L369_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L369_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L370_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L370_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L371_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L370_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L372_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L370_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L373_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L373_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L374_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L373_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L376_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L368_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L378_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L378_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L379_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L379_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L380_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L379_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L381_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L381_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L382_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L381_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L384_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L381_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L385_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L344_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L387_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L425_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L428_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L431_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L432_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L432_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L434_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L432_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L437_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L439_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L439_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L440_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L440_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L442_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L440_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L443_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L440_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L446_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L440_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L447_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L447_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L448_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L448_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L449_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L449_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L450_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L440_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L454_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L440_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L457_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L440_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L459_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L465_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L465_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L466_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L465_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L467_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L467_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L468_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L467_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L469_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L469_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L470_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L469_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L473_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L478_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L480_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L481_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L483_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L483_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L484_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L484_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L485_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L484_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L486_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L484_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L487_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L484_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L488_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L484_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L489_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L484_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L493_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L484_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L494_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L483_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L496_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L500_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L504_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L505_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L508_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L511_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L511_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L512_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L517_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L518_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L521_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L524_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L524_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L525_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L528_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L531_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L532_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L535_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L538_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L539_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L540_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L541_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L541_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L542_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L541_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L543_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L541_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L544_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L544_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L545_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L544_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L547_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L541_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L548_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L541_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L549_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L541_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L550_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L553_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L556_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L559_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L560_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L561_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L561_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L562_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:For_L568_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L572_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L574_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L574_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L576_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L576_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L577_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L576_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L578_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L576_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L579_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L584_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L591_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L596_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L596_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L597_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L596_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L598_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L598_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L599_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:Try_L598_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L601_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L603_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L603_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L604_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L604_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L605_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L603_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L607_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L603_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L610_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L603_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L612_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L603_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L615_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L617_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L620_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L624_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L625_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L626_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L626_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L627_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L629_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L629_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L630_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L632_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L633_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L634_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L634_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L635_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L635_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L636_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L634_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L638_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L638_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L639_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L641_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L642_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L643_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L643_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L644_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L643_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L645_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L643_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L647_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L647_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L651_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L647_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L652_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L652_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L654_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L654_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L655_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L654_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L656_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L652_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L657_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L652_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L659_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L647_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L661_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L664_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L664_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Expr_L665_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L667_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L669_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:FunctionDef_L681_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Return_L682_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L686_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L688_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L688_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L689_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L688_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L690_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L688_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L693_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L688_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L694_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L694_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L695_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:While_L688_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L697_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1388:If_L686_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1388:Assign_L699_C4"}] |
#
# Secret Labs' Regular Expression Engine core module
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# This version of the SRE library can be redistributed under CNRI's
# Python 1.6 license. For any other use, please contact Secret Labs
# AB (info@pythonware.com).
#
# Portions of this engine have been developed in cooperation with
# CNRI. Hewlett-Packard provided funding for 1.6 integration and
# other compatibility work.
#
# 2010-01-16 mrab Python front-end re-written and extended
import string
import sys
import unicodedata
from collections import defaultdict
import _regex
__all__ = ["A", "ASCII", "B", "BESTMATCH", "D", "DEBUG", "E", "ENHANCEMATCH",
"F", "FULLCASE", "I", "IGNORECASE", "L", "LOCALE", "M", "MULTILINE", "R",
"REVERSE", "S", "DOTALL", "T", "TEMPLATE", "U", "UNICODE", "V0", "VERSION0",
"V1", "VERSION1", "W", "WORD", "X", "VERBOSE", "error",
"Scanner"]
# The regex exception.
class error(Exception):
def __init__(self, message, pattern=None, pos=None):
newline = '\n' if isinstance(pattern, str) else b'\n'
self.msg = message
self.pattern = pattern
self.pos = pos
if pattern is not None and pos is not None:
self.lineno = pattern.count(newline, 0, pos) + 1
self.colno = pos - pattern.rfind(newline, 0, pos)
message = "{} at position {}".format(message, pos)
if newline in pattern:
message += " (line {}, column {})".format(self.lineno,
self.colno)
Exception.__init__(self, message)
# The exception for when a positional flag has been turned on in the old
# behaviour.
class _UnscopedFlagSet(Exception):
pass
# The exception for when parsing fails and we want to try something else.
class ParseError(Exception):
pass
# The exception for when there isn't a valid first set.
class _FirstSetError(Exception):
pass
# Flags.
A = ASCII = 0x80 # Assume ASCII locale.
B = BESTMATCH = 0x1000 # Best fuzzy match.
D = DEBUG = 0x200 # Print parsed pattern.
E = ENHANCEMATCH = 0x8000 # Attempt to improve the fit after finding the first
# fuzzy match.
F = FULLCASE = 0x4000 # Unicode full case-folding.
I = IGNORECASE = 0x2 # Ignore case.
L = LOCALE = 0x4 # Assume current 8-bit locale.
M = MULTILINE = 0x8 # Make anchors look for newline.
R = REVERSE = 0x400 # Search backwards.
S = DOTALL = 0x10 # Make dot match newline.
U = UNICODE = 0x20 # Assume Unicode locale.
V0 = VERSION0 = 0x2000 # Old legacy behaviour.
V1 = VERSION1 = 0x100 # New enhanced behaviour.
W = WORD = 0x800 # Default Unicode word breaks.
X = VERBOSE = 0x40 # Ignore whitespace and comments.
T = TEMPLATE = 0x1 # Template (present because re module has it).
DEFAULT_VERSION = VERSION1
_ALL_VERSIONS = VERSION0 | VERSION1
_ALL_ENCODINGS = ASCII | LOCALE | UNICODE
# The default flags for the various versions.
DEFAULT_FLAGS = {VERSION0: 0, VERSION1: FULLCASE}
# The mask for the flags.
GLOBAL_FLAGS = (_ALL_ENCODINGS | _ALL_VERSIONS | BESTMATCH | DEBUG |
ENHANCEMATCH | REVERSE)
SCOPED_FLAGS = FULLCASE | IGNORECASE | MULTILINE | DOTALL | WORD | VERBOSE
ALPHA = frozenset(string.ascii_letters)
DIGITS = frozenset(string.digits)
ALNUM = ALPHA | DIGITS
OCT_DIGITS = frozenset(string.octdigits)
HEX_DIGITS = frozenset(string.hexdigits)
SPECIAL_CHARS = frozenset("()|?*+{^$.[\\#") | frozenset([""])
NAMED_CHAR_PART = ALNUM | frozenset(" -")
PROPERTY_NAME_PART = ALNUM | frozenset(" &_-.")
SET_OPS = ("||", "~~", "&&", "--")
# The width of the code words inside the regex engine.
BYTES_PER_CODE = _regex.get_code_size()
BITS_PER_CODE = BYTES_PER_CODE * 8
# The repeat count which represents infinity.
UNLIMITED = (1 << BITS_PER_CODE) - 1
# The regular expression flags.
REGEX_FLAGS = {"a": ASCII, "b": BESTMATCH, "e": ENHANCEMATCH, "f": FULLCASE,
"i": IGNORECASE, "L": LOCALE, "m": MULTILINE, "r": REVERSE, "s": DOTALL, "u":
UNICODE, "V0": VERSION0, "V1": VERSION1, "w": WORD, "x": VERBOSE}
# The case flags.
CASE_FLAGS = FULLCASE | IGNORECASE
NOCASE = 0
FULLIGNORECASE = FULLCASE | IGNORECASE
FULL_CASE_FOLDING = UNICODE | FULLIGNORECASE
# The number of digits in hexadecimal escapes.
HEX_ESCAPES = {"x": 2, "u": 4, "U": 8}
# A singleton which indicates a comment within a pattern.
COMMENT = object()
FLAGS = object()
# The names of the opcodes.
OPCODES = """
FAILURE
SUCCESS
ANY
ANY_ALL
ANY_ALL_REV
ANY_REV
ANY_U
ANY_U_REV
ATOMIC
BOUNDARY
BRANCH
CALL_REF
CHARACTER
CHARACTER_IGN
CHARACTER_IGN_REV
CHARACTER_REV
DEFAULT_BOUNDARY
DEFAULT_END_OF_WORD
DEFAULT_START_OF_WORD
END
END_OF_LINE
END_OF_LINE_U
END_OF_STRING
END_OF_STRING_LINE
END_OF_STRING_LINE_U
END_OF_WORD
FUZZY
GRAPHEME_BOUNDARY
GREEDY_REPEAT
GROUP
GROUP_CALL
GROUP_EXISTS
LAZY_REPEAT
LOOKAROUND
NEXT
PROPERTY
PROPERTY_IGN
PROPERTY_IGN_REV
PROPERTY_REV
RANGE
RANGE_IGN
RANGE_IGN_REV
RANGE_REV
REF_GROUP
REF_GROUP_FLD
REF_GROUP_FLD_REV
REF_GROUP_IGN
REF_GROUP_IGN_REV
REF_GROUP_REV
SEARCH_ANCHOR
SET_DIFF
SET_DIFF_IGN
SET_DIFF_IGN_REV
SET_DIFF_REV
SET_INTER
SET_INTER_IGN
SET_INTER_IGN_REV
SET_INTER_REV
SET_SYM_DIFF
SET_SYM_DIFF_IGN
SET_SYM_DIFF_IGN_REV
SET_SYM_DIFF_REV
SET_UNION
SET_UNION_IGN
SET_UNION_IGN_REV
SET_UNION_REV
START_OF_LINE
START_OF_LINE_U
START_OF_STRING
START_OF_WORD
STRING
STRING_FLD
STRING_FLD_REV
STRING_IGN
STRING_IGN_REV
STRING_REV
STRING_SET
STRING_SET_FLD
STRING_SET_FLD_REV
STRING_SET_IGN
STRING_SET_IGN_REV
STRING_SET_REV
"""
# Define the opcodes in a namespace.
class Namespace:
pass
OP = Namespace()
for i, op in enumerate(OPCODES.split()):
setattr(OP, op, i)
def _shrink_cache(cache_dict, args_dict, locale_sensitive, max_length, divisor=5):
"""Make room in the given cache.
Args:
cache_dict: The cache dictionary to modify.
args_dict: The dictionary of named list args used by patterns.
max_length: Maximum # of entries in cache_dict before it is shrunk.
divisor: Cache will shrink to max_length - 1/divisor*max_length items.
"""
# Toss out a fraction of the entries at random to make room for new ones.
# A random algorithm was chosen as opposed to simply cache_dict.popitem()
# as popitem could penalize the same regular expression repeatedly based
# on its internal hash value. Being random should spread the cache miss
# love around.
cache_keys = tuple(cache_dict.keys())
overage = len(cache_keys) - max_length
if overage < 0:
# Cache is already within limits. Normally this should not happen
# but it could due to multithreading.
return
number_to_toss = max_length // divisor + overage
# The import is done here to avoid a circular dependency.
import random
if not hasattr(random, 'sample'):
# Do nothing while resolving the circular dependency:
# re->random->warnings->tokenize->string->re
return
for doomed_key in random.sample(cache_keys, number_to_toss):
try:
del cache_dict[doomed_key]
except KeyError:
# Ignore problems if the cache changed from another thread.
pass
# Rebuild the arguments and locale-sensitivity dictionaries.
args_dict.clear()
sensitivity_dict = {}
for pattern, pattern_type, flags, args, default_version, locale in cache_dict:
args_dict[pattern, pattern_type, flags, default_version, locale] = args
try:
sensitivity_dict[pattern_type, pattern] = locale_sensitive[pattern_type, pattern]
except KeyError:
pass
locale_sensitive.clear()
locale_sensitive.update(sensitivity_dict)
def _fold_case(info, string):
"Folds the case of a string."
flags = info.flags
if (flags & _ALL_ENCODINGS) == 0:
flags |= info.guess_encoding
return _regex.fold_case(flags, string)
def is_cased(info, char):
"Checks whether a character is cased."
return len(_regex.get_all_cases(info.flags, char)) > 1
def _compile_firstset(info, fs):
"Compiles the firstset for the pattern."
if not fs or None in fs:
return []
# If we ignore the case, for simplicity we won't build a firstset.
members = set()
for i in fs:
if i.case_flags:
if isinstance(i, Character):
if is_cased(info, i.value):
return []
elif isinstance(i, SetBase):
return []
members.add(i.with_flags(case_flags=NOCASE))
# Build the firstset.
fs = SetUnion(info, list(members), zerowidth=True)
fs = fs.optimise(info, in_set=True)
# Compile the firstset.
return fs.compile(bool(info.flags & REVERSE))
def _flatten_code(code):
"Flattens the code from a list of tuples."
flat_code = []
for c in code:
flat_code.extend(c)
return flat_code
def make_character(info, value, in_set=False):
"Makes a character literal."
if in_set:
# A character set is built case-sensitively.
return Character(value)
return Character(value, case_flags=info.flags & CASE_FLAGS)
def make_ref_group(info, name, position):
"Makes a group reference."
return RefGroup(info, name, position, case_flags=info.flags & CASE_FLAGS)
def make_string_set(info, name):
"Makes a string set."
return StringSet(info, name, case_flags=info.flags & CASE_FLAGS)
def make_property(info, prop, in_set):
"Makes a property."
if in_set:
return prop
return prop.with_flags(case_flags=info.flags & CASE_FLAGS)
def _parse_pattern(source, info):
"Parses a pattern, eg. 'a|b|c'."
branches = [parse_sequence(source, info)]
while source.match("|"):
branches.append(parse_sequence(source, info))
if len(branches) == 1:
return branches[0]
return Branch(branches)
def parse_sequence(source, info):
"Parses a sequence, eg. 'abc'."
sequence = []
applied = False
while True:
# Get literal characters followed by an element.
characters, case_flags, element = parse_literal_and_element(source,
info)
if not element:
# No element, just a literal. We've also reached the end of the
# sequence.
append_literal(characters, case_flags, sequence)
break
if element is COMMENT or element is FLAGS:
append_literal(characters, case_flags, sequence)
elif type(element) is tuple:
# It looks like we've found a quantifier.
ch, saved_pos = element
counts = parse_quantifier(source, info, ch)
if counts:
# It _is_ a quantifier.
apply_quantifier(source, info, counts, characters, case_flags,
ch, saved_pos, applied, sequence)
applied = True
else:
# It's not a quantifier. Maybe it's a fuzzy constraint.
constraints = parse_fuzzy(source, ch)
if constraints:
# It _is_ a fuzzy constraint.
apply_constraint(source, info, constraints, characters,
case_flags, saved_pos, applied, sequence)
applied = True
else:
# The element was just a literal.
characters.append(ord(ch))
append_literal(characters, case_flags, sequence)
applied = False
else:
# We have a literal followed by something else.
append_literal(characters, case_flags, sequence)
sequence.append(element)
applied = False
return make_sequence(sequence)
def apply_quantifier(source, info, counts, characters, case_flags, ch,
saved_pos, applied, sequence):
if characters:
# The quantifier applies to the last character.
append_literal(characters[ : -1], case_flags, sequence)
element = Character(characters[-1], case_flags=case_flags)
else:
# The quantifier applies to the last item in the sequence.
if applied or not sequence:
raise error("nothing to repeat", source.string, saved_pos)
element = sequence.pop()
min_count, max_count = counts
saved_pos = source.pos
ch = source.get()
if ch == "?":
# The "?" suffix that means it's a lazy repeat.
repeated = LazyRepeat
elif ch == "+":
# The "+" suffix that means it's a possessive repeat.
repeated = PossessiveRepeat
else:
# No suffix means that it's a greedy repeat.
source.pos = saved_pos
repeated = GreedyRepeat
# Ignore the quantifier if it applies to a zero-width item or the number of
# repeats is fixed at 1.
if not element.is_empty() and (min_count != 1 or max_count != 1):
element = repeated(element, min_count, max_count)
sequence.append(element)
def apply_constraint(source, info, constraints, characters, case_flags,
saved_pos, applied, sequence):
if characters:
# The constraint applies to the last character.
append_literal(characters[ : -1], case_flags, sequence)
element = Character(characters[-1], case_flags=case_flags)
sequence.append(Fuzzy(element, constraints))
else:
# The constraint applies to the last item in the sequence.
if applied or not sequence:
raise error("nothing for fuzzy constraint", source.string,
saved_pos)
element = sequence.pop()
# If a group is marked as fuzzy then put all of the fuzzy part in the
# group.
if isinstance(element, Group):
element.subpattern = Fuzzy(element.subpattern, constraints)
sequence.append(element)
else:
sequence.append(Fuzzy(element, constraints))
def append_literal(characters, case_flags, sequence):
if characters:
sequence.append(Literal(characters, case_flags=case_flags))
def PossessiveRepeat(element, min_count, max_count):
"Builds a possessive repeat."
return Atomic(GreedyRepeat(element, min_count, max_count))
_QUANTIFIERS = {"?": (0, 1), "*": (0, None), "+": (1, None)}
def parse_quantifier(source, info, ch):
"Parses a quantifier."
q = _QUANTIFIERS.get(ch)
if q:
# It's a quantifier.
return q
if ch == "{":
# Looks like a limited repeated element, eg. 'a{2,3}'.
counts = parse_limited_quantifier(source)
if counts:
return counts
return None
def is_above_limit(count):
"Checks whether a count is above the maximum."
return count is not None and count >= UNLIMITED
def parse_limited_quantifier(source):
"Parses a limited quantifier."
saved_pos = source.pos
min_count = parse_count(source)
if source.match(","):
max_count = parse_count(source)
# No minimum means 0 and no maximum means unlimited.
min_count = int(min_count or 0)
max_count = int(max_count) if max_count else None
if max_count is not None and min_count > max_count:
raise error("min repeat greater than max repeat", source.string,
saved_pos)
else:
if not min_count:
source.pos = saved_pos
return None
min_count = max_count = int(min_count)
if is_above_limit(min_count) or is_above_limit(max_count):
raise error("repeat count too big", source.string, saved_pos)
if not source.match ("}"):
source.pos = saved_pos
return None
return min_count, max_count
def parse_fuzzy(source, ch):
"Parses a fuzzy setting, if present."
if ch != "{":
return None
saved_pos = source.pos
constraints = {}
try:
parse_fuzzy_item(source, constraints)
while source.match(","):
parse_fuzzy_item(source, constraints)
except ParseError:
source.pos = saved_pos
return None
if not source.match("}"):
raise error("expected }", source.string, source.pos)
return constraints
def parse_fuzzy_item(source, constraints):
"Parses a fuzzy setting item."
saved_pos = source.pos
try:
parse_cost_constraint(source, constraints)
except ParseError:
source.pos = saved_pos
parse_cost_equation(source, constraints)
def parse_cost_constraint(source, constraints):
"Parses a cost constraint."
saved_pos = source.pos
ch = source.get()
if ch in ALPHA:
# Syntax: constraint [("<=" | "<") cost]
constraint = parse_constraint(source, constraints, ch)
max_inc = parse_fuzzy_compare(source)
if max_inc is None:
# No maximum cost.
constraints[constraint] = 0, None
else:
# There's a maximum cost.
cost_pos = source.pos
max_cost = int(parse_count(source))
# Inclusive or exclusive limit?
if not max_inc:
max_cost -= 1
if max_cost < 0:
raise error("bad fuzzy cost limit", source.string, cost_pos)
constraints[constraint] = 0, max_cost
elif ch in DIGITS:
# Syntax: cost ("<=" | "<") constraint ("<=" | "<") cost
source.pos = saved_pos
try:
# Minimum cost.
min_cost = int(parse_count(source))
min_inc = parse_fuzzy_compare(source)
if min_inc is None:
raise ParseError()
constraint = parse_constraint(source, constraints, source.get())
max_inc = parse_fuzzy_compare(source)
if max_inc is None:
raise ParseError()
# Maximum cost.
cost_pos = source.pos
max_cost = int(parse_count(source))
# Inclusive or exclusive limits?
if not min_inc:
min_cost += 1
if not max_inc:
max_cost -= 1
if not 0 <= min_cost <= max_cost:
raise error("bad fuzzy cost limit", source.string, cost_pos)
constraints[constraint] = min_cost, max_cost
except ValueError:
raise ParseError()
else:
raise ParseError()
def parse_constraint(source, constraints, ch):
"Parses a constraint."
if ch not in "deis":
raise error("bad fuzzy constraint", source.string, source.pos)
if ch in constraints:
raise error("repeated fuzzy constraint", source.string, source.pos)
return ch
def parse_fuzzy_compare(source):
"Parses a cost comparator."
if source.match("<="):
return True
elif source.match("<"):
return False
else:
return None
def parse_cost_equation(source, constraints):
"Parses a cost equation."
if "cost" in constraints:
raise error("more than one cost equation", source.string, source.pos)
cost = {}
parse_cost_term(source, cost)
while source.match("+"):
parse_cost_term(source, cost)
max_inc = parse_fuzzy_compare(source)
if max_inc is None:
raise error("missing fuzzy cost limit", source.string, source.pos)
max_cost = int(parse_count(source))
if not max_inc:
max_cost -= 1
if max_cost < 0:
raise error("bad fuzzy cost limit", source.string, source.pos)
cost["max"] = max_cost
constraints["cost"] = cost
def parse_cost_term(source, cost):
"Parses a cost equation term."
coeff = parse_count(source)
ch = source.get()
if ch not in "dis":
raise ParseError()
if ch in cost:
raise error("repeated fuzzy cost", source.string, source.pos)
cost[ch] = int(coeff or 1)
def parse_count(source):
"Parses a quantifier's count, which can be empty."
return source.get_while(DIGITS)
def parse_literal_and_element(source, info):
"""Parses a literal followed by an element. The element is FLAGS if it's an
inline flag or None if it has reached the end of a sequence.
"""
characters = []
case_flags = info.flags & CASE_FLAGS
while True:
saved_pos = source.pos
ch = source.get()
if ch in SPECIAL_CHARS:
if ch in ")|":
# The end of a sequence. At the end of the pattern ch is "".
source.pos = saved_pos
return characters, case_flags, None
elif ch == "\\":
# An escape sequence outside a set.
element = parse_escape(source, info, False)
return characters, case_flags, element
elif ch == "(":
# A parenthesised subpattern or a flag.
element = parse_paren(source, info)
if element and element is not COMMENT:
return characters, case_flags, element
elif ch == ".":
# Any character.
if info.flags & DOTALL:
element = AnyAll()
elif info.flags & WORD:
element = AnyU()
else:
element = Any()
return characters, case_flags, element
elif ch == "[":
# A character set.
element = parse_set(source, info)
return characters, case_flags, element
elif ch == "^":
# The start of a line or the string.
if info.flags & MULTILINE:
if info.flags & WORD:
element = StartOfLineU()
else:
element = StartOfLine()
else:
element = StartOfString()
return characters, case_flags, element
elif ch == "$":
# The end of a line or the string.
if info.flags & MULTILINE:
if info.flags & WORD:
element = EndOfLineU()
else:
element = EndOfLine()
else:
if info.flags & WORD:
element = EndOfStringLineU()
else:
element = EndOfStringLine()
return characters, case_flags, element
elif ch in "?*+{":
# Looks like a quantifier.
return characters, case_flags, (ch, saved_pos)
else:
# A literal.
characters.append(ord(ch))
else:
# A literal.
characters.append(ord(ch))
def parse_paren(source, info):
"""Parses a parenthesised subpattern or a flag. Returns FLAGS if it's an
inline flag.
"""
saved_pos = source.pos
ch = source.get()
if ch == "?":
# (?...
saved_pos_2 = source.pos
ch = source.get()
if ch == "<":
# (?<...
saved_pos_3 = source.pos
ch = source.get()
if ch in ("=", "!"):
# (?<=... or (?<!...: lookbehind.
return parse_lookaround(source, info, True, ch == "=")
# (?<...: a named capture group.
source.pos = saved_pos_3
name = parse_name(source)
group = info.open_group(name)
source.expect(">")
saved_flags = info.flags
try:
subpattern = _parse_pattern(source, info)
source.expect(")")
finally:
info.flags = saved_flags
source.ignore_space = bool(info.flags & VERBOSE)
info.close_group()
return Group(info, group, subpattern)
if ch in ("=", "!"):
# (?=... or (?!...: lookahead.
return parse_lookaround(source, info, False, ch == "=")
if ch == "P":
# (?P...: a Python extension.
return parse_extension(source, info)
if ch == "#":
# (?#...: a comment.
return parse_comment(source)
if ch == "(":
# (?(...: a conditional subpattern.
return parse_conditional(source, info)
if ch == ">":
# (?>...: an atomic subpattern.
return parse_atomic(source, info)
if ch == "|":
# (?|...: a common/reset groups branch.
return parse_common(source, info)
if ch == "R" or "0" <= ch <= "9":
# (?R...: probably a call to a group.
return parse_call_group(source, info, ch, saved_pos_2)
if ch == "&":
# (?&...: a call to a named group.
return parse_call_named_group(source, info, saved_pos_2)
# (?...: probably a flags subpattern.
source.pos = saved_pos_2
return parse_flags_subpattern(source, info)
# (...: an unnamed capture group.
source.pos = saved_pos
group = info.open_group()
saved_flags = info.flags
try:
subpattern = _parse_pattern(source, info)
source.expect(")")
finally:
info.flags = saved_flags
source.ignore_space = bool(info.flags & VERBOSE)
info.close_group()
return Group(info, group, subpattern)
def parse_extension(source, info):
"Parses a Python extension."
saved_pos = source.pos
ch = source.get()
if ch == "<":
# (?P<...: a named capture group.
name = parse_name(source)
group = info.open_group(name)
source.expect(">")
saved_flags = info.flags
try:
subpattern = _parse_pattern(source, info)
source.expect(")")
finally:
info.flags = saved_flags
source.ignore_space = bool(info.flags & VERBOSE)
info.close_group()
return Group(info, group, subpattern)
if ch == "=":
# (?P=...: a named group reference.
name = parse_name(source, allow_numeric=True)
source.expect(")")
if info.is_open_group(name):
raise error("cannot refer to an open group", source.string,
saved_pos)
return make_ref_group(info, name, saved_pos)
if ch == ">" or ch == "&":
# (?P>...: a call to a group.
return parse_call_named_group(source, info, saved_pos)
source.pos = saved_pos
raise error("unknown extension", source.string, saved_pos)
def parse_comment(source):
"Parses a comment."
source.skip_while(set(")"), include=False)
source.expect(")")
return COMMENT
def parse_lookaround(source, info, behind, positive):
"Parses a lookaround."
saved_flags = info.flags
try:
subpattern = _parse_pattern(source, info)
source.expect(")")
finally:
info.flags = saved_flags
source.ignore_space = bool(info.flags & VERBOSE)
return LookAround(behind, positive, subpattern)
def parse_conditional(source, info):
"Parses a conditional subpattern."
saved_flags = info.flags
saved_pos = source.pos
try:
group = parse_name(source, True)
source.expect(")")
yes_branch = parse_sequence(source, info)
if source.match("|"):
no_branch = parse_sequence(source, info)
else:
no_branch = Sequence()
source.expect(")")
finally:
info.flags = saved_flags
source.ignore_space = bool(info.flags & VERBOSE)
if yes_branch.is_empty() and no_branch.is_empty():
return Sequence()
return Conditional(info, group, yes_branch, no_branch, saved_pos)
def parse_atomic(source, info):
"Parses an atomic subpattern."
saved_flags = info.flags
try:
subpattern = _parse_pattern(source, info)
source.expect(")")
finally:
info.flags = saved_flags
source.ignore_space = bool(info.flags & VERBOSE)
return Atomic(subpattern)
def parse_common(source, info):
"Parses a common groups branch."
# Capture group numbers in different branches can reuse the group numbers.
initial_group_count = info.group_count
branches = [parse_sequence(source, info)]
final_group_count = info.group_count
while source.match("|"):
info.group_count = initial_group_count
branches.append(parse_sequence(source, info))
final_group_count = max(final_group_count, info.group_count)
info.group_count = final_group_count
source.expect(")")
if len(branches) == 1:
return branches[0]
return Branch(branches)
def parse_call_group(source, info, ch, pos):
"Parses a call to a group."
if ch == "R":
group = "0"
else:
group = ch + source.get_while(DIGITS)
source.expect(")")
return CallGroup(info, group, pos)
def parse_call_named_group(source, info, pos):
"Parses a call to a named group."
group = parse_name(source)
source.expect(")")
return CallGroup(info, group, pos)
def parse_flag_set(source):
"Parses a set of inline flags."
flags = 0
try:
while True:
saved_pos = source.pos
ch = source.get()
if ch == "V":
ch += source.get()
flags |= REGEX_FLAGS[ch]
except KeyError:
source.pos = saved_pos
return flags
def parse_flags(source, info):
"Parses flags being turned on/off."
flags_on = parse_flag_set(source)
if source.match("-"):
flags_off = parse_flag_set(source)
if not flags_off:
raise error("bad inline flags: no flags after '-'", source.string,
source.pos)
else:
flags_off = 0
if flags_on & LOCALE:
# Remember that this pattern as an inline locale flag.
info.inline_locale = True
return flags_on, flags_off
def parse_subpattern(source, info, flags_on, flags_off):
"Parses a subpattern with scoped flags."
saved_flags = info.flags
info.flags = (info.flags | flags_on) & ~flags_off
source.ignore_space = bool(info.flags & VERBOSE)
try:
subpattern = _parse_pattern(source, info)
source.expect(")")
finally:
info.flags = saved_flags
source.ignore_space = bool(info.flags & VERBOSE)
return subpattern
def parse_flags_subpattern(source, info):
"""Parses a flags subpattern. It could be inline flags or a subpattern
possibly with local flags. If it's a subpattern, then that's returned;
if it's a inline flags, then FLAGS is returned.
"""
flags_on, flags_off = parse_flags(source, info)
if flags_off & GLOBAL_FLAGS:
raise error("bad inline flags: cannot turn off global flag",
source.string, source.pos)
if flags_on & flags_off:
raise error("bad inline flags: flag turned on and off", source.string,
source.pos)
# Handle flags which are global in all regex behaviours.
new_global_flags = (flags_on & ~info.global_flags) & GLOBAL_FLAGS
if new_global_flags:
info.global_flags |= new_global_flags
# A global has been turned on, so reparse the pattern.
raise _UnscopedFlagSet(info.global_flags)
# Ensure that from now on we have only scoped flags.
flags_on &= ~GLOBAL_FLAGS
if source.match(":"):
return parse_subpattern(source, info, flags_on, flags_off)
if source.match(")"):
parse_positional_flags(source, info, flags_on, flags_off)
return FLAGS
raise error("unknown extension", source.string, source.pos)
def parse_positional_flags(source, info, flags_on, flags_off):
"Parses positional flags."
version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION
if version == VERSION0:
# Positional flags are global and can only be turned on.
if flags_off:
raise error("bad inline flags: cannot turn flags off",
source.string, source.pos)
new_global_flags = flags_on & ~info.global_flags
if new_global_flags:
info.global_flags |= new_global_flags
# A global has been turned on, so reparse the pattern.
raise _UnscopedFlagSet(info.global_flags)
else:
info.flags = (info.flags | flags_on) & ~flags_off
source.ignore_space = bool(info.flags & VERBOSE)
def parse_name(source, allow_numeric=False, allow_group_0=False):
"Parses a name."
name = source.get_while(set(")>"), include=False)
if not name:
raise error("bad group name", source.string, source.pos)
if name.isdigit():
min_group = 0 if allow_group_0 else 1
if not allow_numeric or int(name) < min_group:
raise error("bad group name", source.string, source.pos)
else:
if not name.isidentifier():
raise error("bad group name", source.string, source.pos)
return name
def is_octal(string):
"Checks whether a string is octal."
return all(ch in OCT_DIGITS for ch in string)
def is_decimal(string):
"Checks whether a string is decimal."
return all(ch in DIGITS for ch in string)
def is_hexadecimal(string):
"Checks whether a string is hexadecimal."
return all(ch in HEX_DIGITS for ch in string)
def parse_escape(source, info, in_set):
"Parses an escape sequence."
saved_ignore = source.ignore_space
source.ignore_space = False
ch = source.get()
source.ignore_space = saved_ignore
if not ch:
# A backslash at the end of the pattern.
raise error("bad escape", source.string, source.pos)
if ch in HEX_ESCAPES:
# A hexadecimal escape sequence.
return parse_hex_escape(source, info, HEX_ESCAPES[ch], in_set)
elif ch == "g" and not in_set:
# A group reference.
saved_pos = source.pos
try:
return parse_group_ref(source, info)
except error:
# Invalid as a group reference, so assume it's a literal.
source.pos = saved_pos
return make_character(info, ord(ch), in_set)
elif ch == "G" and not in_set:
# A search anchor.
return SearchAnchor()
elif ch == "L" and not in_set:
# A string set.
return parse_string_set(source, info)
elif ch == "N":
# A named codepoint.
return parse_named_char(source, info, in_set)
elif ch in "pP":
# A Unicode property, positive or negative.
return parse_property(source, info, ch == "p", in_set)
elif ch == "X" and not in_set:
# A grapheme cluster.
return Grapheme()
elif ch in ALPHA:
# An alphabetic escape sequence.
# Positional escapes aren't allowed inside a character set.
if not in_set:
if info.flags & WORD:
value = WORD_POSITION_ESCAPES.get(ch)
else:
value = POSITION_ESCAPES.get(ch)
if value:
return value
value = CHARSET_ESCAPES.get(ch)
if value:
return value
value = CHARACTER_ESCAPES.get(ch)
if value:
return Character(ord(value))
return make_character(info, ord(ch), in_set)
elif ch in DIGITS:
# A numeric escape sequence.
return parse_numeric_escape(source, info, ch, in_set)
else:
# A literal.
return make_character(info, ord(ch), in_set)
def parse_numeric_escape(source, info, ch, in_set):
"Parses a numeric escape sequence."
if in_set or ch == "0":
# Octal escape sequence, max 3 digits.
return parse_octal_escape(source, info, [ch], in_set)
# At least 1 digit, so either octal escape or group.
digits = ch
saved_pos = source.pos
ch = source.get()
if ch in DIGITS:
# At least 2 digits, so either octal escape or group.
digits += ch
saved_pos = source.pos
ch = source.get()
if is_octal(digits) and ch in OCT_DIGITS:
# 3 octal digits, so octal escape sequence.
encoding = info.flags & _ALL_ENCODINGS
if encoding == ASCII or encoding == LOCALE:
octal_mask = 0xFF
else:
octal_mask = 0x1FF
value = int(digits + ch, 8) & octal_mask
return make_character(info, value)
# Group reference.
source.pos = saved_pos
if info.is_open_group(digits):
raise error("cannot refer to an open group", source.string, source.pos)
return make_ref_group(info, digits, source.pos)
def parse_octal_escape(source, info, digits, in_set):
"Parses an octal escape sequence."
saved_pos = source.pos
ch = source.get()
while len(digits) < 3 and ch in OCT_DIGITS:
digits.append(ch)
saved_pos = source.pos
ch = source.get()
source.pos = saved_pos
try:
value = int("".join(digits), 8)
return make_character(info, value, in_set)
except ValueError:
raise error("bad octal escape", source.string, source.pos)
def parse_hex_escape(source, info, expected_len, in_set):
"Parses a hex escape sequence."
digits = []
for i in range(expected_len):
ch = source.get()
if ch not in HEX_DIGITS:
raise error("bad hex escape", source.string, source.pos)
digits.append(ch)
value = int("".join(digits), 16)
return make_character(info, value, in_set)
def parse_group_ref(source, info):
"Parses a group reference."
source.expect("<")
saved_pos = source.pos
name = parse_name(source, True)
source.expect(">")
if info.is_open_group(name):
raise error("cannot refer to an open group", source.string, source.pos)
return make_ref_group(info, name, saved_pos)
def parse_string_set(source, info):
"Parses a string set reference."
source.expect("<")
name = parse_name(source, True)
source.expect(">")
if name is None or name not in info.kwargs:
raise error("undefined named list", source.string, source.pos)
return make_string_set(info, name)
def parse_named_char(source, info, in_set):
"Parses a named character."
saved_pos = source.pos
if source.match("{"):
name = source.get_while(NAMED_CHAR_PART)
if source.match("}"):
try:
value = unicodedata.lookup(name)
return make_character(info, ord(value), in_set)
except KeyError:
raise error("undefined character name", source.string,
source.pos)
source.pos = saved_pos
return make_character(info, ord("N"), in_set)
def parse_property(source, info, positive, in_set):
"Parses a Unicode property."
saved_pos = source.pos
ch = source.get()
if ch == "{":
negate = source.match("^")
prop_name, name = parse_property_name(source)
if source.match("}"):
# It's correctly delimited.
prop = lookup_property(prop_name, name, positive != negate, source)
return make_property(info, prop, in_set)
elif ch and ch in "CLMNPSZ":
# An abbreviated property, eg \pL.
prop = lookup_property(None, ch, positive, source)
return make_property(info, prop, in_set)
# Not a property, so treat as a literal "p" or "P".
source.pos = saved_pos
ch = "p" if positive else "P"
return make_character(info, ord(ch), in_set)
def parse_property_name(source):
"Parses a property name, which may be qualified."
name = source.get_while(PROPERTY_NAME_PART)
saved_pos = source.pos
ch = source.get()
if ch and ch in ":=":
prop_name = name
name = source.get_while(ALNUM | set(" &_-./")).strip()
if name:
# Name after the ":" or "=", so it's a qualified name.
saved_pos = source.pos
else:
# No name after the ":" or "=", so assume it's an unqualified name.
prop_name, name = None, prop_name
else:
prop_name = None
source.pos = saved_pos
return prop_name, name
def parse_set(source, info):
"Parses a character set."
version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION
saved_ignore = source.ignore_space
source.ignore_space = False
# Negative set?
negate = source.match("^")
try:
if version == VERSION0:
item = parse_set_imp_union(source, info)
else:
item = parse_set_union(source, info)
if not source.match("]"):
raise error("missing ]", source.string, source.pos)
finally:
source.ignore_space = saved_ignore
if negate:
item = item.with_flags(positive=not item.positive)
item = item.with_flags(case_flags=info.flags & CASE_FLAGS)
return item
def parse_set_union(source, info):
"Parses a set union ([x||y])."
items = [parse_set_symm_diff(source, info)]
while source.match("||"):
items.append(parse_set_symm_diff(source, info))
if len(items) == 1:
return items[0]
return SetUnion(info, items)
def parse_set_symm_diff(source, info):
"Parses a set symmetric difference ([x~~y])."
items = [parse_set_inter(source, info)]
while source.match("~~"):
items.append(parse_set_inter(source, info))
if len(items) == 1:
return items[0]
return SetSymDiff(info, items)
def parse_set_inter(source, info):
"Parses a set intersection ([x&&y])."
items = [parse_set_diff(source, info)]
while source.match("&&"):
items.append(parse_set_diff(source, info))
if len(items) == 1:
return items[0]
return SetInter(info, items)
def parse_set_diff(source, info):
"Parses a set difference ([x--y])."
items = [parse_set_imp_union(source, info)]
while source.match("--"):
items.append(parse_set_imp_union(source, info))
if len(items) == 1:
return items[0]
return SetDiff(info, items)
def parse_set_imp_union(source, info):
"Parses a set implicit union ([xy])."
version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION
items = [parse_set_member(source, info)]
while True:
saved_pos = source.pos
if source.match("]"):
# End of the set.
source.pos = saved_pos
break
if version == VERSION1 and any(source.match(op) for op in SET_OPS):
# The new behaviour has set operators.
source.pos = saved_pos
break
items.append(parse_set_member(source, info))
if len(items) == 1:
return items[0]
return SetUnion(info, items)
def parse_set_member(source, info):
"Parses a member in a character set."
# Parse a set item.
start = parse_set_item(source, info)
saved_pos1 = source.pos
if (not isinstance(start, Character) or not start.positive or not
source.match("-")):
# It's not the start of a range.
return start
version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION
# It looks like the start of a range of characters.
saved_pos2 = source.pos
if version == VERSION1 and source.match("-"):
# It's actually the set difference operator '--', so return the
# character.
source.pos = saved_pos1
return start
if source.match("]"):
# We've reached the end of the set, so return both the character and
# hyphen.
source.pos = saved_pos2
return SetUnion(info, [start, Character(ord("-"))])
# Parse a set item.
end = parse_set_item(source, info)
if not isinstance(end, Character) or not end.positive:
# It's not a range, so return the character, hyphen and property.
return SetUnion(info, [start, Character(ord("-")), end])
# It _is_ a range.
if start.value > end.value:
raise error("bad character range", source.string, source.pos)
if start.value == end.value:
return start
return Range(start.value, end.value)
def parse_set_item(source, info):
"Parses an item in a character set."
version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION
if source.match("\\"):
# An escape sequence in a set.
return parse_escape(source, info, True)
saved_pos = source.pos
if source.match("[:"):
# Looks like a POSIX character class.
try:
return parse_posix_class(source, info)
except ParseError:
# Not a POSIX character class.
source.pos = saved_pos
if version == VERSION1 and source.match("["):
# It's the start of a nested set.
# Negative set?
negate = source.match("^")
item = parse_set_union(source, info)
if not source.match("]"):
raise error("missing ]", source.string, source.pos)
if negate:
item = item.with_flags(positive=not item.positive)
return item
ch = source.get()
if not ch:
raise error("bad set", source.string, source.pos)
return Character(ord(ch))
def parse_posix_class(source, info):
"Parses a POSIX character class."
negate = source.match("^")
prop_name, name = parse_property_name(source)
if not source.match(":]"):
raise ParseError()
return lookup_property(prop_name, name, not negate, source)
def float_to_rational(flt):
"Converts a float to a rational pair."
int_part = int(flt)
error = flt - int_part
if abs(error) < 0.0001:
return int_part, 1
den, num = float_to_rational(1.0 / error)
return int_part * den + num, den
def numeric_to_rational(numeric):
"Converts a numeric string to a rational string, if possible."
if numeric[ : 1] == "-":
sign, numeric = numeric[0], numeric[1 : ]
else:
sign = ""
parts = numeric.split("/")
if len(parts) == 2:
num, den = float_to_rational(float(parts[0]) / float(parts[1]))
elif len(parts) == 1:
num, den = float_to_rational(float(parts[0]))
else:
raise ValueError()
result = "{}{}/{}".format(sign, num, den)
if result.endswith("/1"):
return result[ : -2]
return result
def standardise_name(name):
"Standardises a property or value name."
try:
return numeric_to_rational("".join(name))
except (ValueError, ZeroDivisionError):
return "".join(ch for ch in name if ch not in "_- ").upper()
def lookup_property(property, value, positive, source=None):
"Looks up a property."
# Normalise the names (which may still be lists).
property = standardise_name(property) if property else None
value = standardise_name(value)
if (property, value) == ("GENERALCATEGORY", "ASSIGNED"):
property, value, positive = "GENERALCATEGORY", "UNASSIGNED", not positive
if property:
# Both the property and the value are provided.
prop = PROPERTIES.get(property)
if not prop:
if not source:
raise error("unknown property")
raise error("unknown property", source.string, source.pos)
prop_id, value_dict = prop
val_id = value_dict.get(value)
if val_id is None:
if not source:
raise error("unknown property value")
raise error("unknown property value", source.string, source.pos)
if "YES" in value_dict and val_id == 0:
positive, val_id = not positive, 1
return Property((prop_id << 16) | val_id, positive)
# Only the value is provided.
# It might be the name of a GC, script or block value.
for property in ("GC", "SCRIPT", "BLOCK"):
prop_id, value_dict = PROPERTIES.get(property)
val_id = value_dict.get(value)
if val_id is not None:
return Property((prop_id << 16) | val_id, positive)
# It might be the name of a binary property.
prop = PROPERTIES.get(value)
if prop:
prop_id, value_dict = prop
if "YES" in value_dict:
return Property((prop_id << 16) | 1, positive)
# It might be the name of a binary property starting with a prefix.
if value.startswith("IS"):
prop = PROPERTIES.get(value[2 : ])
if prop:
prop_id, value_dict = prop
if "YES" in value_dict:
return Property((prop_id << 16) | 1, positive)
# It might be the name of a script or block starting with a prefix.
for prefix, property in (("IS", "SCRIPT"), ("IN", "BLOCK")):
if value.startswith(prefix):
prop_id, value_dict = PROPERTIES.get(property)
val_id = value_dict.get(value[2 : ])
if val_id is not None:
return Property((prop_id << 16) | val_id, positive)
# Unknown property.
if not source:
raise error("unknown property")
raise error("unknown property", source.string, source.pos)
def _compile_replacement(source, pattern, is_unicode):
"Compiles a replacement template escape sequence."
ch = source.get()
if ch in ALPHA:
# An alphabetic escape sequence.
value = CHARACTER_ESCAPES.get(ch)
if value:
return False, [ord(value)]
if ch in HEX_ESCAPES and (ch == "x" or is_unicode):
# A hexadecimal escape sequence.
return False, [parse_repl_hex_escape(source, HEX_ESCAPES[ch])]
if ch == "g":
# A group preference.
return True, [compile_repl_group(source, pattern)]
if ch == "N" and is_unicode:
# A named character.
value = parse_repl_named_char(source)
if value is not None:
return False, [value]
return False, [ord("\\"), ord(ch)]
if isinstance(source.sep, bytes):
octal_mask = 0xFF
else:
octal_mask = 0x1FF
if ch == "0":
# An octal escape sequence.
digits = ch
while len(digits) < 3:
saved_pos = source.pos
ch = source.get()
if ch not in OCT_DIGITS:
source.pos = saved_pos
break
digits += ch
return False, [int(digits, 8) & octal_mask]
if ch in DIGITS:
# Either an octal escape sequence (3 digits) or a group reference (max
# 2 digits).
digits = ch
saved_pos = source.pos
ch = source.get()
if ch in DIGITS:
digits += ch
saved_pos = source.pos
ch = source.get()
if ch and is_octal(digits + ch):
# An octal escape sequence.
return False, [int(digits + ch, 8) & octal_mask]
# A group reference.
source.pos = saved_pos
return True, [int(digits)]
if ch == "\\":
# An escaped backslash is a backslash.
return False, [ord("\\")]
if not ch:
# A trailing backslash.
raise error("bad escape", source.string, source.pos)
# An escaped non-backslash is a backslash followed by the literal.
return False, [ord("\\"), ord(ch)]
def parse_repl_hex_escape(source, expected_len):
"Parses a hex escape sequence in a replacement string."
digits = []
for i in range(expected_len):
ch = source.get()
if ch not in HEX_DIGITS:
raise error("bad hex escape", source.string, source.pos)
digits.append(ch)
return int("".join(digits), 16)
def parse_repl_named_char(source):
"Parses a named character in a replacement string."
saved_pos = source.pos
if source.match("{"):
name = source.get_while(ALPHA | set(" "))
if source.match("}"):
try:
value = unicodedata.lookup(name)
return ord(value)
except KeyError:
raise error("undefined character name", source.string,
source.pos)
source.pos = saved_pos
return None
def compile_repl_group(source, pattern):
"Compiles a replacement template group reference."
source.expect("<")
name = parse_name(source, True, True)
source.expect(">")
if name.isdigit():
index = int(name)
if not 0 <= index <= pattern.groups:
raise error("invalid group", source.string, source.pos)
return index
try:
return pattern.groupindex[name]
except KeyError:
raise IndexError("unknown group")
# The regular expression is parsed into a syntax tree. The different types of
# node are defined below.
INDENT = " "
POSITIVE_OP = 0x1
ZEROWIDTH_OP = 0x2
FUZZY_OP = 0x4
REVERSE_OP = 0x8
REQUIRED_OP = 0x10
POS_TEXT = {False: "NON-MATCH", True: "MATCH"}
CASE_TEXT = {NOCASE: "", IGNORECASE: " SIMPLE_IGNORE_CASE", FULLCASE: "",
FULLIGNORECASE: " FULL_IGNORE_CASE"}
def make_sequence(items):
if len(items) == 1:
return items[0]
return Sequence(items)
# Common base class for all nodes.
class RegexBase:
def __init__(self):
self._key = self.__class__
def with_flags(self, positive=None, case_flags=None, zerowidth=None):
if positive is None:
positive = self.positive
else:
positive = bool(positive)
if case_flags is None:
case_flags = self.case_flags
else:
case_flags = case_flags & CASE_FLAGS
if zerowidth is None:
zerowidth = self.zerowidth
else:
zerowidth = bool(zerowidth)
if (positive == self.positive and case_flags == self.case_flags and
zerowidth == self.zerowidth):
return self
return self.rebuild(positive, case_flags, zerowidth)
def fix_groups(self, pattern, reverse, fuzzy):
pass
def optimise(self, info):
return self
def pack_characters(self, info):
return self
def remove_captures(self):
return self
def is_atomic(self):
return True
def can_be_affix(self):
return True
def contains_group(self):
return False
def get_firstset(self, reverse):
raise _FirstSetError()
def has_simple_start(self):
return False
def compile(self, reverse=False, fuzzy=False):
return self._compile(reverse, fuzzy)
def dump(self, indent, reverse):
self._dump(indent, reverse)
def is_empty(self):
return False
def __hash__(self):
return hash(self._key)
def __eq__(self, other):
return type(self) is type(other) and self._key == other._key
def __ne__(self, other):
return not self.__eq__(other)
def get_required_string(self, reverse):
return self.max_width(), None
# Base class for zero-width nodes.
class ZeroWidthBase(RegexBase):
def __init__(self, positive=True):
RegexBase.__init__(self)
self.positive = bool(positive)
self._key = self.__class__, self.positive
def get_firstset(self, reverse):
return set([None])
def _compile(self, reverse, fuzzy):
flags = 0
if self.positive:
flags |= POSITIVE_OP
if fuzzy:
flags |= FUZZY_OP
if reverse:
flags |= REVERSE_OP
return [(self._opcode, flags)]
def _dump(self, indent, reverse):
print("{}{} {}".format(INDENT * indent, self._op_name,
POS_TEXT[self.positive]))
def max_width(self):
return 0
class Any(RegexBase):
_opcode = {False: OP.ANY, True: OP.ANY_REV}
_op_name = "ANY"
def has_simple_start(self):
return True
def _compile(self, reverse, fuzzy):
flags = 0
if fuzzy:
flags |= FUZZY_OP
return [(self._opcode[reverse], flags)]
def _dump(self, indent, reverse):
print("{}{}".format(INDENT * indent, self._op_name))
def max_width(self):
return 1
class AnyAll(Any):
_opcode = {False: OP.ANY_ALL, True: OP.ANY_ALL_REV}
_op_name = "ANY_ALL"
class AnyU(Any):
_opcode = {False: OP.ANY_U, True: OP.ANY_U_REV}
_op_name = "ANY_U"
class Atomic(RegexBase):
def __init__(self, subpattern):
RegexBase.__init__(self)
self.subpattern = subpattern
def fix_groups(self, pattern, reverse, fuzzy):
self.subpattern.fix_groups(pattern, reverse, fuzzy)
def optimise(self, info):
self.subpattern = self.subpattern.optimise(info)
if self.subpattern.is_empty():
return self.subpattern
return self
def pack_characters(self, info):
self.subpattern = self.subpattern.pack_characters(info)
return self
def remove_captures(self):
self.subpattern = self.subpattern.remove_captures()
return self
def can_be_affix(self):
return self.subpattern.can_be_affix()
def contains_group(self):
return self.subpattern.contains_group()
def get_firstset(self, reverse):
return self.subpattern.get_firstset(reverse)
def has_simple_start(self):
return self.subpattern.has_simple_start()
def _compile(self, reverse, fuzzy):
return ([(OP.ATOMIC, )] + self.subpattern.compile(reverse, fuzzy) +
[(OP.END, )])
def _dump(self, indent, reverse):
print("{}ATOMIC".format(INDENT * indent))
self.subpattern.dump(indent + 1, reverse)
def is_empty(self):
return self.subpattern.is_empty()
def __eq__(self, other):
return (type(self) is type(other) and self.subpattern ==
other.subpattern)
def max_width(self):
return self.subpattern.max_width()
def get_required_string(self, reverse):
return self.subpattern.get_required_string(reverse)
class Boundary(ZeroWidthBase):
_opcode = OP.BOUNDARY
_op_name = "BOUNDARY"
class Branch(RegexBase):
def __init__(self, branches):
RegexBase.__init__(self)
self.branches = branches
def fix_groups(self, pattern, reverse, fuzzy):
for b in self.branches:
b.fix_groups(pattern, reverse, fuzzy)
def optimise(self, info):
# Flatten branches within branches.
branches = Branch._flatten_branches(info, self.branches)
# Move any common prefix or suffix out of the branches.
prefix, branches = Branch._split_common_prefix(info, branches)
suffix, branches = Branch._split_common_suffix(info, branches)
# Merge branches starting with the same character. (If a character
# prefix doesn't match in one branch, it won't match in any of the
# others starting with that same character.)
branches = Branch._merge_common_prefixes(info, branches)
# Try to reduce adjacent single-character branches to sets.
branches = Branch._reduce_to_set(info, branches)
if len(branches) > 1:
sequence = prefix + [Branch(branches)] + suffix
else:
sequence = prefix + branches + suffix
return make_sequence(sequence)
def optimise(self, info):
# Flatten branches within branches.
branches = Branch._flatten_branches(info, self.branches)
# Try to reduce adjacent single-character branches to sets.
branches = Branch._reduce_to_set(info, branches)
if len(branches) > 1:
sequence = [Branch(branches)]
else:
sequence = branches
return make_sequence(sequence)
def pack_characters(self, info):
self.branches = [b.pack_characters(info) for b in self.branches]
return self
def remove_captures(self):
self.branches = [b.remove_captures() for b in self.branches]
return self
def is_atomic(self):
return all(b.is_atomic() for b in self.branches)
def can_be_affix(self):
return all(b.can_be_affix() for b in self.branches)
def contains_group(self):
return any(b.contains_group() for b in self.branches)
def get_firstset(self, reverse):
fs = set()
for b in self.branches:
fs |= b.get_firstset(reverse)
return fs or set([None])
def _compile(self, reverse, fuzzy):
code = [(OP.BRANCH, )]
for b in self.branches:
code.extend(b.compile(reverse, fuzzy))
code.append((OP.NEXT, ))
code[-1] = (OP.END, )
return code
def _dump(self, indent, reverse):
print("{}BRANCH".format(INDENT * indent))
self.branches[0].dump(indent + 1, reverse)
for b in self.branches[1 : ]:
print("{}OR".format(INDENT * indent))
b.dump(indent + 1, reverse)
@staticmethod
def _flatten_branches(info, branches):
# Flatten the branches so that there aren't branches of branches.
new_branches = []
for b in branches:
b = b.optimise(info)
if isinstance(b, Branch):
new_branches.extend(b.branches)
else:
new_branches.append(b)
return new_branches
@staticmethod
def _split_common_prefix(info, branches):
# Common leading items can be moved out of the branches.
# Get the items in the branches.
alternatives = []
for b in branches:
if isinstance(b, Sequence):
alternatives.append(b.items)
else:
alternatives.append([b])
# What is the maximum possible length of the prefix?
max_count = min(len(a) for a in alternatives)
# What is the longest common prefix?
prefix = alternatives[0]
pos = 0
end_pos = max_count
while pos < end_pos and prefix[pos].can_be_affix() and all(a[pos] ==
prefix[pos] for a in alternatives):
pos += 1
count = pos
if info.flags & UNICODE:
# We need to check that we're not splitting a sequence of
# characters which could form part of full case-folding.
count = pos
while count > 0 and not all(Branch._can_split(a, count) for a in
alternatives):
count -= 1
# No common prefix is possible.
if count == 0:
return [], branches
# Rebuild the branches.
new_branches = []
for a in alternatives:
new_branches.append(make_sequence(a[count : ]))
return prefix[ : count], new_branches
@staticmethod
def _split_common_suffix(info, branches):
# Common trailing items can be moved out of the branches.
# Get the items in the branches.
alternatives = []
for b in branches:
if isinstance(b, Sequence):
alternatives.append(b.items)
else:
alternatives.append([b])
# What is the maximum possible length of the suffix?
max_count = min(len(a) for a in alternatives)
# What is the longest common suffix?
suffix = alternatives[0]
pos = -1
end_pos = -1 - max_count
while pos > end_pos and suffix[pos].can_be_affix() and all(a[pos] ==
suffix[pos] for a in alternatives):
pos -= 1
count = -1 - pos
if info.flags & UNICODE:
# We need to check that we're not splitting a sequence of
# characters which could form part of full case-folding.
while count > 0 and not all(Branch._can_split_rev(a, count) for a
in alternatives):
count -= 1
# No common suffix is possible.
if count == 0:
return [], branches
# Rebuild the branches.
new_branches = []
for a in alternatives:
new_branches.append(make_sequence(a[ : -count]))
return suffix[-count : ], new_branches
@staticmethod
def _can_split(items, count):
# Check the characters either side of the proposed split.
if not Branch._is_full_case(items, count - 1):
return True
if not Branch._is_full_case(items, count):
return True
# Check whether a 1-1 split would be OK.
if Branch._is_folded(items[count - 1 : count + 1]):
return False
# Check whether a 1-2 split would be OK.
if (Branch._is_full_case(items, count + 2) and
Branch._is_folded(items[count - 1 : count + 2])):
return False
# Check whether a 2-1 split would be OK.
if (Branch._is_full_case(items, count - 2) and
Branch._is_folded(items[count - 2 : count + 1])):
return False
return True
@staticmethod
def _can_split_rev(items, count):
end = len(items)
# Check the characters either side of the proposed split.
if not Branch._is_full_case(items, end - count):
return True
if not Branch._is_full_case(items, end - count - 1):
return True
# Check whether a 1-1 split would be OK.
if Branch._is_folded(items[end - count - 1 : end - count + 1]):
return False
# Check whether a 1-2 split would be OK.
if (Branch._is_full_case(items, end - count + 2) and
Branch._is_folded(items[end - count - 1 : end - count + 2])):
return False
# Check whether a 2-1 split would be OK.
if (Branch._is_full_case(items, end - count - 2) and
Branch._is_folded(items[end - count - 2 : end - count + 1])):
return False
return True
@staticmethod
def _merge_common_prefixes(info, branches):
# Branches with the same case-sensitive character prefix can be grouped
# together if they are separated only by other branches with a
# character prefix.
prefixed = defaultdict(list)
order = {}
new_branches = []
for b in branches:
if Branch._is_simple_character(b):
# Branch starts with a simple character.
prefixed[b.value].append([b])
order.setdefault(b.value, len(order))
elif (isinstance(b, Sequence) and b.items and
Branch._is_simple_character(b.items[0])):
# Branch starts with a simple character.
prefixed[b.items[0].value].append(b.items)
order.setdefault(b.items[0].value, len(order))
else:
Branch._flush_char_prefix(info, prefixed, order, new_branches)
new_branches.append(b)
Branch._flush_char_prefix(info, prefixed, order, new_branches)
return new_branches
@staticmethod
def _is_simple_character(c):
return isinstance(c, Character) and c.positive and not c.case_flags
@staticmethod
def _reduce_to_set(info, branches):
# Can the branches be reduced to a set?
new_branches = []
items = set()
case_flags = NOCASE
for b in branches:
if isinstance(b, (Character, Property, SetBase)):
# Branch starts with a single character.
if b.case_flags != case_flags:
# Different case sensitivity, so flush.
Branch._flush_set_members(info, items, case_flags,
new_branches)
case_flags = b.case_flags
items.add(b.with_flags(case_flags=NOCASE))
else:
Branch._flush_set_members(info, items, case_flags,
new_branches)
new_branches.append(b)
Branch._flush_set_members(info, items, case_flags, new_branches)
return new_branches
@staticmethod
def _flush_char_prefix(info, prefixed, order, new_branches):
# Flush the prefixed branches.
if not prefixed:
return
for value, branches in sorted(prefixed.items(), key=lambda pair:
order[pair[0]]):
if len(branches) == 1:
new_branches.append(make_sequence(branches[0]))
else:
subbranches = []
optional = False
for b in branches:
if len(b) > 1:
subbranches.append(make_sequence(b[1 : ]))
elif not optional:
subbranches.append(Sequence())
optional = True
sequence = Sequence([Character(value), Branch(subbranches)])
new_branches.append(sequence.optimise(info))
prefixed.clear()
order.clear()
@staticmethod
def _flush_set_members(info, items, case_flags, new_branches):
# Flush the set members.
if not items:
return
if len(items) == 1:
item = list(items)[0]
else:
item = SetUnion(info, list(items)).optimise(info)
new_branches.append(item.with_flags(case_flags=case_flags))
items.clear()
@staticmethod
def _is_full_case(items, i):
if not 0 <= i < len(items):
return False
item = items[i]
return (isinstance(item, Character) and item.positive and
(item.case_flags & FULLIGNORECASE) == FULLIGNORECASE)
@staticmethod
def _is_folded(items):
if len(items) < 2:
return False
for i in items:
if (not isinstance(i, Character) or not i.positive or not
i.case_flags):
return False
folded = "".join(chr(i.value) for i in items)
folded = _regex.fold_case(FULL_CASE_FOLDING, folded)
# Get the characters which expand to multiple codepoints on folding.
expanding_chars = _regex.get_expand_on_folding()
for c in expanding_chars:
if folded == _regex.fold_case(FULL_CASE_FOLDING, c):
return True
return False
def is_empty(self):
return all(b.is_empty() for b in self.branches)
def __eq__(self, other):
return type(self) is type(other) and self.branches == other.branches
def max_width(self):
return max(b.max_width() for b in self.branches)
class CallGroup(RegexBase):
def __init__(self, info, group, position):
RegexBase.__init__(self)
self.info = info
self.group = group
self.position = position
self._key = self.__class__, self.group
def fix_groups(self, pattern, reverse, fuzzy):
try:
self.group = int(self.group)
except ValueError:
try:
self.group = self.info.group_index[self.group]
except KeyError:
raise error("unknown group", pattern, self.position)
if not 0 <= self.group <= self.info.group_count:
raise error("unknown group", pattern, self.position)
if self.group > 0 and self.info.open_group_count[self.group] > 1:
raise error("ambiguous group reference", pattern, self.position)
self.info.group_calls.append((self, reverse, fuzzy))
self._key = self.__class__, self.group
def remove_captures(self):
raise error("group reference not allowed", pattern, self.position)
def _compile(self, reverse, fuzzy):
return [(OP.GROUP_CALL, self.call_ref)]
def _dump(self, indent, reverse):
print("{}GROUP_CALL {}".format(INDENT * indent, self.group))
def __eq__(self, other):
return type(self) is type(other) and self.group == other.group
def max_width(self):
return UNLIMITED
class Character(RegexBase):
_opcode = {(NOCASE, False): OP.CHARACTER, (IGNORECASE, False):
OP.CHARACTER_IGN, (FULLCASE, False): OP.CHARACTER, (FULLIGNORECASE,
False): OP.CHARACTER_IGN, (NOCASE, True): OP.CHARACTER_REV, (IGNORECASE,
True): OP.CHARACTER_IGN_REV, (FULLCASE, True): OP.CHARACTER_REV,
(FULLIGNORECASE, True): OP.CHARACTER_IGN_REV}
def __init__(self, value, positive=True, case_flags=NOCASE,
zerowidth=False):
RegexBase.__init__(self)
self.value = value
self.positive = bool(positive)
self.case_flags = case_flags
self.zerowidth = bool(zerowidth)
if (self.positive and (self.case_flags & FULLIGNORECASE) ==
FULLIGNORECASE):
self.folded = _regex.fold_case(FULL_CASE_FOLDING, chr(self.value))
else:
self.folded = chr(self.value)
self._key = (self.__class__, self.value, self.positive,
self.case_flags, self.zerowidth)
def rebuild(self, positive, case_flags, zerowidth):
return Character(self.value, positive, case_flags, zerowidth)
def optimise(self, info, in_set=False):
return self
def get_firstset(self, reverse):
return set([self])
def has_simple_start(self):
return True
def _compile(self, reverse, fuzzy):
flags = 0
if self.positive:
flags |= POSITIVE_OP
if self.zerowidth:
flags |= ZEROWIDTH_OP
if fuzzy:
flags |= FUZZY_OP
code = PrecompiledCode([self._opcode[self.case_flags, reverse], flags,
self.value])
if len(self.folded) > 1:
# The character expands on full case-folding.
code = Branch([code, String([ord(c) for c in self.folded],
case_flags=self.case_flags)])
return code.compile(reverse, fuzzy)
def _dump(self, indent, reverse):
display = ascii(chr(self.value)).lstrip("bu")
print("{}CHARACTER {} {}{}".format(INDENT * indent,
POS_TEXT[self.positive], display, CASE_TEXT[self.case_flags]))
def matches(self, ch):
return (ch == self.value) == self.positive
def max_width(self):
return len(self.folded)
def get_required_string(self, reverse):
if not self.positive:
return 1, None
self.folded_characters = tuple(ord(c) for c in self.folded)
return 0, self
class Conditional(RegexBase):
def __init__(self, info, group, yes_item, no_item, position):
RegexBase.__init__(self)
self.info = info
self.group = group
self.yes_item = yes_item
self.no_item = no_item
self.position = position
def fix_groups(self, pattern, reverse, fuzzy):
try:
self.group = int(self.group)
except ValueError:
try:
self.group = self.info.group_index[self.group]
except KeyError:
raise error("unknown group", pattern, self.position)
if not 1 <= self.group <= self.info.group_count:
raise error("unknown group", pattern, self.position)
self.yes_item.fix_groups(pattern, reverse, fuzzy)
self.no_item.fix_groups(pattern, reverse, fuzzy)
def optimise(self, info):
yes_item = self.yes_item.optimise(info)
no_item = self.no_item.optimise(info)
return Conditional(info, self.group, yes_item, no_item, self.position)
def pack_characters(self, info):
self.yes_item = self.yes_item.pack_characters(info)
self.no_item = self.no_item.pack_characters(info)
return self
def remove_captures(self):
self.yes_item = self.yes_item.remove_captures()
self.no_item = self.no_item.remove_captures()
def is_atomic(self):
return self.yes_item.is_atomic() and self.no_item.is_atomic()
def can_be_affix(self):
return self.yes_item.can_be_affix() and self.no_item.can_be_affix()
def contains_group(self):
return self.yes_item.contains_group() or self.no_item.contains_group()
def get_firstset(self, reverse):
return (self.yes_item.get_firstset(reverse) |
self.no_item.get_firstset(reverse))
def _compile(self, reverse, fuzzy):
code = [(OP.GROUP_EXISTS, self.group)]
code.extend(self.yes_item.compile(reverse, fuzzy))
add_code = self.no_item.compile(reverse, fuzzy)
if add_code:
code.append((OP.NEXT, ))
code.extend(add_code)
code.append((OP.END, ))
return code
def _dump(self, indent, reverse):
print("{}GROUP_EXISTS {}".format(INDENT * indent, self.group))
self.yes_item.dump(indent + 1, reverse)
if self.no_item:
print("{}OR".format(INDENT * indent))
self.no_item.dump(indent + 1, reverse)
def is_empty(self):
return self.yes_item.is_empty() and self.no_item.is_empty()
def __eq__(self, other):
return type(self) is type(other) and (self.group, self.yes_item,
self.no_item) == (other.group, other.yes_item, other.no_item)
def max_width(self):
return max(self.yes_item.max_width(), self.no_item.max_width())
class DefaultBoundary(ZeroWidthBase):
_opcode = OP.DEFAULT_BOUNDARY
_op_name = "DEFAULT_BOUNDARY"
class DefaultEndOfWord(ZeroWidthBase):
_opcode = OP.DEFAULT_END_OF_WORD
_op_name = "DEFAULT_END_OF_WORD"
class DefaultStartOfWord(ZeroWidthBase):
_opcode = OP.DEFAULT_START_OF_WORD
_op_name = "DEFAULT_START_OF_WORD"
class EndOfLine(ZeroWidthBase):
_opcode = OP.END_OF_LINE
_op_name = "END_OF_LINE"
class EndOfLineU(EndOfLine):
_opcode = OP.END_OF_LINE_U
_op_name = "END_OF_LINE_U"
class EndOfString(ZeroWidthBase):
_opcode = OP.END_OF_STRING
_op_name = "END_OF_STRING"
class EndOfStringLine(ZeroWidthBase):
_opcode = OP.END_OF_STRING_LINE
_op_name = "END_OF_STRING_LINE"
class EndOfStringLineU(EndOfStringLine):
_opcode = OP.END_OF_STRING_LINE_U
_op_name = "END_OF_STRING_LINE_U"
class EndOfWord(ZeroWidthBase):
_opcode = OP.END_OF_WORD
_op_name = "END_OF_WORD"
class Fuzzy(RegexBase):
def __init__(self, subpattern, constraints=None):
RegexBase.__init__(self)
if constraints is None:
constraints = {}
self.subpattern = subpattern
self.constraints = constraints
# If an error type is mentioned in the cost equation, then its maximum
# defaults to unlimited.
if "cost" in constraints:
for e in "dis":
if e in constraints["cost"]:
constraints.setdefault(e, (0, None))
# If any error type is mentioned, then all the error maxima default to
# 0, otherwise they default to unlimited.
if set(constraints) & set("dis"):
for e in "dis":
constraints.setdefault(e, (0, 0))
else:
for e in "dis":
constraints.setdefault(e, (0, None))
# The maximum of the generic error type defaults to unlimited.
constraints.setdefault("e", (0, None))
# The cost equation defaults to equal costs. Also, the cost of any
# error type not mentioned in the cost equation defaults to 0.
if "cost" in constraints:
for e in "dis":
constraints["cost"].setdefault(e, 0)
else:
constraints["cost"] = {"d": 1, "i": 1, "s": 1, "max":
constraints["e"][1]}
def fix_groups(self, pattern, reverse, fuzzy):
self.subpattern.fix_groups(pattern, reverse, True)
def pack_characters(self, info):
self.subpattern = self.subpattern.pack_characters(info)
return self
def remove_captures(self):
self.subpattern = self.subpattern.remove_captures()
return self
def is_atomic(self):
return self.subpattern.is_atomic()
def contains_group(self):
return self.subpattern.contains_group()
def _compile(self, reverse, fuzzy):
# The individual limits.
arguments = []
for e in "dise":
v = self.constraints[e]
arguments.append(v[0])
arguments.append(UNLIMITED if v[1] is None else v[1])
# The coeffs of the cost equation.
for e in "dis":
arguments.append(self.constraints["cost"][e])
# The maximum of the cost equation.
v = self.constraints["cost"]["max"]
arguments.append(UNLIMITED if v is None else v)
flags = 0
if reverse:
flags |= REVERSE_OP
return ([(OP.FUZZY, flags) + tuple(arguments)] +
self.subpattern.compile(reverse, True) + [(OP.END,)])
def _dump(self, indent, reverse):
constraints = self._constraints_to_string()
if constraints:
constraints = " " + constraints
print("{}FUZZY{}".format(INDENT * indent, constraints))
self.subpattern.dump(indent + 1, reverse)
def is_empty(self):
return self.subpattern.is_empty()
def __eq__(self, other):
return (type(self) is type(other) and self.subpattern ==
other.subpattern)
def max_width(self):
return UNLIMITED
def _constraints_to_string(self):
constraints = []
for name in "ids":
min, max = self.constraints[name]
if max == 0:
continue
con = ""
if min > 0:
con = "{}<=".format(min)
con += name
if max is not None:
con += "<={}".format(max)
constraints.append(con)
cost = []
for name in "ids":
coeff = self.constraints["cost"][name]
if coeff > 0:
cost.append("{}{}".format(coeff, name))
limit = self.constraints["cost"]["max"]
if limit is not None and limit > 0:
cost = "{}<={}".format("+".join(cost), limit)
constraints.append(cost)
return ",".join(constraints)
class Grapheme(RegexBase):
def _compile(self, reverse, fuzzy):
# Match at least 1 character until a grapheme boundary is reached. Note
# that this is the same whether matching forwards or backwards.
character_matcher = LazyRepeat(AnyAll(), 1, None).compile(reverse,
fuzzy)
boundary_matcher = [(OP.GRAPHEME_BOUNDARY, 1)]
return character_matcher + boundary_matcher
def _dump(self, indent, reverse):
print("{}GRAPHEME".format(INDENT * indent))
def max_width(self):
return UNLIMITED
class GreedyRepeat(RegexBase):
_opcode = OP.GREEDY_REPEAT
_op_name = "GREEDY_REPEAT"
def __init__(self, subpattern, min_count, max_count):
RegexBase.__init__(self)
self.subpattern = subpattern
self.min_count = min_count
self.max_count = max_count
def fix_groups(self, pattern, reverse, fuzzy):
self.subpattern.fix_groups(pattern, reverse, fuzzy)
def optimise(self, info):
subpattern = self.subpattern.optimise(info)
return type(self)(subpattern, self.min_count, self.max_count)
def pack_characters(self, info):
self.subpattern = self.subpattern.pack_characters(info)
return self
def remove_captures(self):
self.subpattern = self.subpattern.remove_captures()
return self
def is_atomic(self):
return self.min_count == self.max_count and self.subpattern.is_atomic()
def contains_group(self):
return self.subpattern.contains_group()
def get_firstset(self, reverse):
fs = self.subpattern.get_firstset(reverse)
if self.min_count == 0:
fs.add(None)
return fs
def _compile(self, reverse, fuzzy):
repeat = [self._opcode, self.min_count]
if self.max_count is None:
repeat.append(UNLIMITED)
else:
repeat.append(self.max_count)
subpattern = self.subpattern.compile(reverse, fuzzy)
if not subpattern:
return []
return ([tuple(repeat)] + subpattern + [(OP.END, )])
def _dump(self, indent, reverse):
if self.max_count is None:
limit = "INF"
else:
limit = self.max_count
print("{}{} {} {}".format(INDENT * indent, self._op_name,
self.min_count, limit))
self.subpattern.dump(indent + 1, reverse)
def is_empty(self):
return self.subpattern.is_empty()
def __eq__(self, other):
return type(self) is type(other) and (self.subpattern, self.min_count,
self.max_count) == (other.subpattern, other.min_count,
other.max_count)
def max_width(self):
if self.max_count is None:
return UNLIMITED
return self.subpattern.max_width() * self.max_count
def get_required_string(self, reverse):
max_count = UNLIMITED if self.max_count is None else self.max_count
if self.min_count == 0:
w = self.subpattern.max_width() * max_count
return min(w, UNLIMITED), None
ofs, req = self.subpattern.get_required_string(reverse)
if req:
return ofs, req
w = self.subpattern.max_width() * max_count
return min(w, UNLIMITED), None
class Group(RegexBase):
def __init__(self, info, group, subpattern):
RegexBase.__init__(self)
self.info = info
self.group = group
self.subpattern = subpattern
self.call_ref = None
def fix_groups(self, pattern, reverse, fuzzy):
self.info.defined_groups[self.group] = (self, reverse, fuzzy)
self.subpattern.fix_groups(pattern, reverse, fuzzy)
def optimise(self, info):
subpattern = self.subpattern.optimise(info)
return Group(self.info, self.group, subpattern)
def pack_characters(self, info):
self.subpattern = self.subpattern.pack_characters(info)
return self
def remove_captures(self):
return self.subpattern.remove_captures()
def is_atomic(self):
return self.subpattern.is_atomic()
def can_be_affix(self):
return False
def contains_group(self):
return True
def get_firstset(self, reverse):
return self.subpattern.get_firstset(reverse)
def has_simple_start(self):
return self.subpattern.has_simple_start()
def _compile(self, reverse, fuzzy):
code = []
key = self.group, reverse, fuzzy
ref = self.info.call_refs.get(key)
if ref is not None:
code += [(OP.CALL_REF, ref)]
public_group = private_group = self.group
if private_group < 0:
public_group = self.info.private_groups[private_group]
private_group = self.info.group_count - private_group
code += ([(OP.GROUP, private_group, public_group)] +
self.subpattern.compile(reverse, fuzzy) + [(OP.END, )])
if ref is not None:
code += [(OP.END, )]
return code
def _dump(self, indent, reverse):
group = self.group
if group < 0:
group = private_groups[group]
print("{}GROUP {}".format(INDENT * indent, group))
self.subpattern.dump(indent + 1, reverse)
def __eq__(self, other):
return (type(self) is type(other) and (self.group, self.subpattern) ==
(other.group, other.subpattern))
def max_width(self):
return self.subpattern.max_width()
def get_required_string(self, reverse):
return self.subpattern.get_required_string(reverse)
class LazyRepeat(GreedyRepeat):
_opcode = OP.LAZY_REPEAT
_op_name = "LAZY_REPEAT"
class LookAround(RegexBase):
_dir_text = {False: "AHEAD", True: "BEHIND"}
def __new__(cls, behind, positive, subpattern):
if positive and subpattern.is_empty():
return subpattern
return RegexBase.__new__(cls)
def __init__(self, behind, positive, subpattern):
RegexBase.__init__(self)
self.behind = bool(behind)
self.positive = bool(positive)
self.subpattern = subpattern
def fix_groups(self, pattern, reverse, fuzzy):
self.subpattern.fix_groups(pattern, self.behind, fuzzy)
def optimise(self, info):
subpattern = self.subpattern.optimise(info)
return LookAround(self.behind, self.positive, subpattern)
def pack_characters(self, info):
self.subpattern = self.subpattern.pack_characters(info)
return self
def remove_captures(self):
return self.subpattern.remove_captures()
def is_atomic(self):
return self.subpattern.is_atomic()
def can_be_affix(self):
return self.subpattern.can_be_affix()
def contains_group(self):
return self.subpattern.contains_group()
def _compile(self, reverse, fuzzy):
return ([(OP.LOOKAROUND, int(self.positive), int(not self.behind))] +
self.subpattern.compile(self.behind) + [(OP.END, )])
def _dump(self, indent, reverse):
print("{}LOOK{} {}".format(INDENT * indent,
self._dir_text[self.behind], POS_TEXT[self.positive]))
self.subpattern.dump(indent + 1, self.behind)
def is_empty(self):
return self.subpattern.is_empty()
def __eq__(self, other):
return type(self) is type(other) and (self.behind, self.positive,
self.subpattern) == (other.behind, other.positive, other.subpattern)
def max_width(self):
return 0
class PrecompiledCode(RegexBase):
def __init__(self, code):
self.code = code
def _compile(self, reverse, fuzzy):
return [tuple(self.code)]
class Property(RegexBase):
_opcode = {(NOCASE, False): OP.PROPERTY, (IGNORECASE, False):
OP.PROPERTY_IGN, (FULLCASE, False): OP.PROPERTY, (FULLIGNORECASE, False):
OP.PROPERTY_IGN, (NOCASE, True): OP.PROPERTY_REV, (IGNORECASE, True):
OP.PROPERTY_IGN_REV, (FULLCASE, True): OP.PROPERTY_REV, (FULLIGNORECASE,
True): OP.PROPERTY_IGN_REV}
def __init__(self, value, positive=True, case_flags=NOCASE,
zerowidth=False):
RegexBase.__init__(self)
self.value = value
self.positive = bool(positive)
self.case_flags = case_flags
self.zerowidth = bool(zerowidth)
self._key = (self.__class__, self.value, self.positive,
self.case_flags, self.zerowidth)
def rebuild(self, positive, case_flags, zerowidth):
return Property(self.value, positive, case_flags, zerowidth)
def optimise(self, info, in_set=False):
return self
def get_firstset(self, reverse):
return set([self])
def has_simple_start(self):
return True
def _compile(self, reverse, fuzzy):
flags = 0
if self.positive:
flags |= POSITIVE_OP
if self.zerowidth:
flags |= ZEROWIDTH_OP
if fuzzy:
flags |= FUZZY_OP
return [(self._opcode[self.case_flags, reverse], flags, self.value)]
def _dump(self, indent, reverse):
prop = PROPERTY_NAMES[self.value >> 16]
name, value = prop[0], prop[1][self.value & 0xFFFF]
print("{}PROPERTY {} {}:{}{}".format(INDENT * indent,
POS_TEXT[self.positive], name, value, CASE_TEXT[self.case_flags]))
def matches(self, ch):
return _regex.has_property_value(self.value, ch) == self.positive
def max_width(self):
return 1
class Range(RegexBase):
_opcode = {(NOCASE, False): OP.RANGE, (IGNORECASE, False): OP.RANGE_IGN,
(FULLCASE, False): OP.RANGE, (FULLIGNORECASE, False): OP.RANGE_IGN,
(NOCASE, True): OP.RANGE_REV, (IGNORECASE, True): OP.RANGE_IGN_REV,
(FULLCASE, True): OP.RANGE_REV, (FULLIGNORECASE, True): OP.RANGE_IGN_REV}
_op_name = "RANGE"
def __init__(self, lower, upper, positive=True, case_flags=NOCASE,
zerowidth=False):
RegexBase.__init__(self)
self.lower = lower
self.upper = upper
self.positive = bool(positive)
self.case_flags = case_flags
self.zerowidth = bool(zerowidth)
self._key = (self.__class__, self.lower, self.upper, self.positive,
self.case_flags, self.zerowidth)
def rebuild(self, positive, case_flags, zerowidth):
return Range(self.lower, self.upper, positive, case_flags, zerowidth)
def optimise(self, info, in_set=False):
# Is the range case-sensitive?
if not self.positive or not (self.case_flags & IGNORECASE) or in_set:
return self
# Is full case-folding possible?
if (not (info.flags & UNICODE) or (self.case_flags & FULLIGNORECASE) !=
FULLIGNORECASE):
return self
# Get the characters which expand to multiple codepoints on folding.
expanding_chars = _regex.get_expand_on_folding()
# Get the folded characters in the range.
items = []
for ch in expanding_chars:
if self.lower <= ord(ch) <= self.upper:
folded = _regex.fold_case(FULL_CASE_FOLDING, ch)
items.append(String([ord(c) for c in folded],
case_flags=self.case_flags))
if not items:
# We can fall back to simple case-folding.
return self
if len(items) < self.upper - self.lower + 1:
# Not all the characters are covered by the full case-folding.
items.insert(0, self)
return Branch(items)
def _compile(self, reverse, fuzzy):
flags = 0
if self.positive:
flags |= POSITIVE_OP
if self.zerowidth:
flags |= ZEROWIDTH_OP
if fuzzy:
flags |= FUZZY_OP
return [(self._opcode[self.case_flags, reverse], flags, self.lower,
self.upper)]
def _dump(self, indent, reverse):
display_lower = ascii(chr(self.lower)).lstrip("bu")
display_upper = ascii(chr(self.upper)).lstrip("bu")
print("{}RANGE {} {} {}{}".format(INDENT * indent,
POS_TEXT[self.positive], display_lower, display_upper,
CASE_TEXT[self.case_flags]))
def matches(self, ch):
return (self.lower <= ch <= self.upper) == self.positive
def max_width(self):
return 1
class RefGroup(RegexBase):
_opcode = {(NOCASE, False): OP.REF_GROUP, (IGNORECASE, False):
OP.REF_GROUP_IGN, (FULLCASE, False): OP.REF_GROUP, (FULLIGNORECASE,
False): OP.REF_GROUP_FLD, (NOCASE, True): OP.REF_GROUP_REV, (IGNORECASE,
True): OP.REF_GROUP_IGN_REV, (FULLCASE, True): OP.REF_GROUP_REV,
(FULLIGNORECASE, True): OP.REF_GROUP_FLD_REV}
def __init__(self, info, group, position, case_flags=NOCASE):
RegexBase.__init__(self)
self.info = info
self.group = group
self.position = position
self.case_flags = case_flags
self._key = self.__class__, self.group, self.case_flags
def fix_groups(self, pattern, reverse, fuzzy):
try:
self.group = int(self.group)
except ValueError:
try:
self.group = self.info.group_index[self.group]
except KeyError:
raise error("unknown group", pattern, self.position)
if not 1 <= self.group <= self.info.group_count:
raise error("unknown group", pattern, self.position)
self._key = self.__class__, self.group, self.case_flags
def remove_captures(self):
raise error("group reference not allowed", pattern, self.position)
def _compile(self, reverse, fuzzy):
flags = 0
if fuzzy:
flags |= FUZZY_OP
return [(self._opcode[self.case_flags, reverse], flags, self.group)]
def _dump(self, indent, reverse):
print("{}REF_GROUP {}{}".format(INDENT * indent, self.group,
CASE_TEXT[self.case_flags]))
def max_width(self):
return UNLIMITED
class SearchAnchor(ZeroWidthBase):
_opcode = OP.SEARCH_ANCHOR
_op_name = "SEARCH_ANCHOR"
class Sequence(RegexBase):
def __init__(self, items=None):
RegexBase.__init__(self)
if items is None:
items = []
self.items = items
def fix_groups(self, pattern, reverse, fuzzy):
for s in self.items:
s.fix_groups(pattern, reverse, fuzzy)
def optimise(self, info):
# Flatten the sequences.
items = []
for s in self.items:
s = s.optimise(info)
if isinstance(s, Sequence):
items.extend(s.items)
else:
items.append(s)
return make_sequence(items)
def pack_characters(self, info):
"Packs sequences of characters into strings."
items = []
characters = []
case_flags = NOCASE
for s in self.items:
if type(s) is Character and s.positive:
if s.case_flags != case_flags:
# Different case sensitivity, so flush, unless neither the
# previous nor the new character are cased.
if s.case_flags or is_cased(info, s.value):
Sequence._flush_characters(info, characters,
case_flags, items)
case_flags = s.case_flags
characters.append(s.value)
elif type(s) is String or type(s) is Literal:
if s.case_flags != case_flags:
# Different case sensitivity, so flush, unless the neither
# the previous nor the new string are cased.
if s.case_flags or any(is_cased(info, c) for c in
characters):
Sequence._flush_characters(info, characters,
case_flags, items)
case_flags = s.case_flags
characters.extend(s.characters)
else:
Sequence._flush_characters(info, characters, case_flags, items)
items.append(s.pack_characters(info))
Sequence._flush_characters(info, characters, case_flags, items)
return make_sequence(items)
def remove_captures(self):
self.items = [s.remove_captures() for s in self.items]
return self
def is_atomic(self):
return all(s.is_atomic() for s in self.items)
def can_be_affix(self):
return False
def contains_group(self):
return any(s.contains_group() for s in self.items)
def get_firstset(self, reverse):
fs = set()
items = self.items
if reverse:
items.reverse()
for s in items:
fs |= s.get_firstset(reverse)
if None not in fs:
return fs
fs.discard(None)
return fs | set([None])
def has_simple_start(self):
return self.items and self.items[0].has_simple_start()
def _compile(self, reverse, fuzzy):
seq = self.items
if reverse:
seq = seq[::-1]
code = []
for s in seq:
code.extend(s.compile(reverse, fuzzy))
return code
def _dump(self, indent, reverse):
for s in self.items:
s.dump(indent, reverse)
@staticmethod
def _flush_characters(info, characters, case_flags, items):
if not characters:
return
# Disregard case_flags if all of the characters are case-less.
if case_flags & IGNORECASE:
if not any(is_cased(info, c) for c in characters):
case_flags = NOCASE
if len(characters) == 1:
items.append(Character(characters[0], case_flags=case_flags))
else:
items.append(String(characters, case_flags=case_flags))
characters[:] = []
def is_empty(self):
return all(i.is_empty() for i in self.items)
def __eq__(self, other):
return type(self) is type(other) and self.items == other.items
def max_width(self):
return sum(s.max_width() for s in self.items)
def get_required_string(self, reverse):
seq = self.items
if reverse:
seq = seq[::-1]
offset = 0
for s in seq:
ofs, req = s.get_required_string(reverse)
offset += ofs
if req:
return offset, req
return offset, None
class SetBase(RegexBase):
def __init__(self, info, items, positive=True, case_flags=NOCASE,
zerowidth=False):
RegexBase.__init__(self)
self.info = info
self.items = tuple(items)
self.positive = bool(positive)
self.case_flags = case_flags
self.zerowidth = bool(zerowidth)
self.char_width = 1
self._key = (self.__class__, self.items, self.positive,
self.case_flags, self.zerowidth)
def rebuild(self, positive, case_flags, zerowidth):
return type(self)(self.info, self.items, positive, case_flags,
zerowidth).optimise(self.info)
def get_firstset(self, reverse):
return set([self])
def has_simple_start(self):
return True
def _compile(self, reverse, fuzzy):
flags = 0
if self.positive:
flags |= POSITIVE_OP
if self.zerowidth:
flags |= ZEROWIDTH_OP
if fuzzy:
flags |= FUZZY_OP
code = [(self._opcode[self.case_flags, reverse], flags)]
for m in self.items:
code.extend(m.compile())
code.append((OP.END, ))
return code
def _dump(self, indent, reverse):
print("{}{} {}{}".format(INDENT * indent, self._op_name,
POS_TEXT[self.positive], CASE_TEXT[self.case_flags]))
for i in self.items:
i.dump(indent + 1, reverse)
def _handle_case_folding(self, info, in_set):
# Is the set case-sensitive?
if not self.positive or not (self.case_flags & IGNORECASE) or in_set:
return self
# Is full case-folding possible?
if (not (self.info.flags & UNICODE) or (self.case_flags &
FULLIGNORECASE) !=
FULLIGNORECASE):
return self
# Get the characters which expand to multiple codepoints on folding.
expanding_chars = _regex.get_expand_on_folding()
# Get the folded characters in the set.
items = []
seen = set()
for ch in expanding_chars:
if self.matches(ord(ch)):
folded = _regex.fold_case(FULL_CASE_FOLDING, ch)
if folded not in seen:
items.append(String([ord(c) for c in folded],
case_flags=self.case_flags))
seen.add(folded)
if not items:
# We can fall back to simple case-folding.
return self
return Branch([self] + items)
def max_width(self):
# Is the set case-sensitive?
if not self.positive or not (self.case_flags & IGNORECASE):
return 1
# Is full case-folding possible?
if (not (self.info.flags & UNICODE) or (self.case_flags &
FULLIGNORECASE) != FULLIGNORECASE):
return 1
# Get the characters which expand to multiple codepoints on folding.
expanding_chars = _regex.get_expand_on_folding()
# Get the folded characters in the set.
seen = set()
for ch in expanding_chars:
if self.matches(ord(ch)):
folded = _regex.fold_case(FULL_CASE_FOLDING, ch)
seen.add(folded)
if not seen:
return 1
return max(len(folded) for folded in seen)
class SetDiff(SetBase):
_opcode = {(NOCASE, False): OP.SET_DIFF, (IGNORECASE, False):
OP.SET_DIFF_IGN, (FULLCASE, False): OP.SET_DIFF, (FULLIGNORECASE, False):
OP.SET_DIFF_IGN, (NOCASE, True): OP.SET_DIFF_REV, (IGNORECASE, True):
OP.SET_DIFF_IGN_REV, (FULLCASE, True): OP.SET_DIFF_REV, (FULLIGNORECASE,
True): OP.SET_DIFF_IGN_REV}
_op_name = "SET_DIFF"
def optimise(self, info, in_set=False):
items = self.items
if len(items) > 2:
items = [items[0], SetUnion(info, items[1 : ])]
if len(items) == 1:
return items[0].with_flags(case_flags=self.case_flags,
zerowidth=self.zerowidth).optimise(info, in_set)
self.items = tuple(m.optimise(info, in_set=True) for m in items)
return self._handle_case_folding(info, in_set)
def matches(self, ch):
m = self.items[0].matches(ch) and not self.items[1].matches(ch)
return m == self.positive
class SetInter(SetBase):
_opcode = {(NOCASE, False): OP.SET_INTER, (IGNORECASE, False):
OP.SET_INTER_IGN, (FULLCASE, False): OP.SET_INTER, (FULLIGNORECASE,
False): OP.SET_INTER_IGN, (NOCASE, True): OP.SET_INTER_REV, (IGNORECASE,
True): OP.SET_INTER_IGN_REV, (FULLCASE, True): OP.SET_INTER_REV,
(FULLIGNORECASE, True): OP.SET_INTER_IGN_REV}
_op_name = "SET_INTER"
def optimise(self, info, in_set=False):
items = []
for m in self.items:
m = m.optimise(info, in_set=True)
if isinstance(m, SetInter) and m.positive:
# Intersection in intersection.
items.extend(m.items)
else:
items.append(m)
if len(items) == 1:
return items[0].with_flags(case_flags=self.case_flags,
zerowidth=self.zerowidth).optimise(info, in_set)
self.items = tuple(items)
return self._handle_case_folding(info, in_set)
def matches(self, ch):
m = all(i.matches(ch) for i in self.items)
return m == self.positive
class SetSymDiff(SetBase):
_opcode = {(NOCASE, False): OP.SET_SYM_DIFF, (IGNORECASE, False):
OP.SET_SYM_DIFF_IGN, (FULLCASE, False): OP.SET_SYM_DIFF, (FULLIGNORECASE,
False): OP.SET_SYM_DIFF_IGN, (NOCASE, True): OP.SET_SYM_DIFF_REV,
(IGNORECASE, True): OP.SET_SYM_DIFF_IGN_REV, (FULLCASE, True):
OP.SET_SYM_DIFF_REV, (FULLIGNORECASE, True): OP.SET_SYM_DIFF_IGN_REV}
_op_name = "SET_SYM_DIFF"
def optimise(self, info, in_set=False):
items = []
for m in self.items:
m = m.optimise(info, in_set=True)
if isinstance(m, SetSymDiff) and m.positive:
# Symmetric difference in symmetric difference.
items.extend(m.items)
else:
items.append(m)
if len(items) == 1:
return items[0].with_flags(case_flags=self.case_flags,
zerowidth=self.zerowidth).optimise(info, in_set)
self.items = tuple(items)
return self._handle_case_folding(info, in_set)
def matches(self, ch):
m = False
for i in self.items:
m = m != i.matches(ch)
return m == self.positive
class SetUnion(SetBase):
_opcode = {(NOCASE, False): OP.SET_UNION, (IGNORECASE, False):
OP.SET_UNION_IGN, (FULLCASE, False): OP.SET_UNION, (FULLIGNORECASE,
False): OP.SET_UNION_IGN, (NOCASE, True): OP.SET_UNION_REV, (IGNORECASE,
True): OP.SET_UNION_IGN_REV, (FULLCASE, True): OP.SET_UNION_REV,
(FULLIGNORECASE, True): OP.SET_UNION_IGN_REV}
_op_name = "SET_UNION"
def optimise(self, info, in_set=False):
items = []
for m in self.items:
m = m.optimise(info, in_set=True)
if isinstance(m, SetUnion) and m.positive:
# Union in union.
items.extend(m.items)
else:
items.append(m)
if len(items) == 1:
i = items[0]
return i.with_flags(positive=i.positive == self.positive,
case_flags=self.case_flags,
zerowidth=self.zerowidth).optimise(info, in_set)
self.items = tuple(items)
return self._handle_case_folding(info, in_set)
def _compile(self, reverse, fuzzy):
flags = 0
if self.positive:
flags |= POSITIVE_OP
if self.zerowidth:
flags |= ZEROWIDTH_OP
if fuzzy:
flags |= FUZZY_OP
characters, others = defaultdict(list), []
for m in self.items:
if isinstance(m, Character):
characters[m.positive].append(m.value)
else:
others.append(m)
code = [(self._opcode[self.case_flags, reverse], flags)]
for positive, values in characters.items():
flags = 0
if positive:
flags |= POSITIVE_OP
if len(values) == 1:
code.append((OP.CHARACTER, flags, values[0]))
else:
code.append((OP.STRING, flags, len(values)) + tuple(values))
for m in others:
code.extend(m.compile())
code.append((OP.END, ))
return code
def matches(self, ch):
m = any(i.matches(ch) for i in self.items)
return m == self.positive
class StartOfLine(ZeroWidthBase):
_opcode = OP.START_OF_LINE
_op_name = "START_OF_LINE"
class StartOfLineU(StartOfLine):
_opcode = OP.START_OF_LINE_U
_op_name = "START_OF_LINE_U"
class StartOfString(ZeroWidthBase):
_opcode = OP.START_OF_STRING
_op_name = "START_OF_STRING"
class StartOfWord(ZeroWidthBase):
_opcode = OP.START_OF_WORD
_op_name = "START_OF_WORD"
class String(RegexBase):
_opcode = {(NOCASE, False): OP.STRING, (IGNORECASE, False): OP.STRING_IGN,
(FULLCASE, False): OP.STRING, (FULLIGNORECASE, False): OP.STRING_FLD,
(NOCASE, True): OP.STRING_REV, (IGNORECASE, True): OP.STRING_IGN_REV,
(FULLCASE, True): OP.STRING_REV, (FULLIGNORECASE, True):
OP.STRING_FLD_REV}
def __init__(self, characters, case_flags=NOCASE):
self.characters = tuple(characters)
self.case_flags = case_flags
if (self.case_flags & FULLIGNORECASE) == FULLIGNORECASE:
folded_characters = []
for char in self.characters:
folded = _regex.fold_case(FULL_CASE_FOLDING, chr(char))
folded_characters.extend(ord(c) for c in folded)
else:
folded_characters = self.characters
self.folded_characters = tuple(folded_characters)
self.required = False
self._key = self.__class__, self.characters, self.case_flags
def get_firstset(self, reverse):
if reverse:
pos = -1
else:
pos = 0
return set([Character(self.characters[pos],
case_flags=self.case_flags)])
def has_simple_start(self):
return True
def _compile(self, reverse, fuzzy):
flags = 0
if fuzzy:
flags |= FUZZY_OP
if self.required:
flags |= REQUIRED_OP
return [(self._opcode[self.case_flags, reverse], flags,
len(self.folded_characters)) + self.folded_characters]
def _dump(self, indent, reverse):
display = ascii("".join(chr(c) for c in self.characters)).lstrip("bu")
print("{}STRING {}{}".format(INDENT * indent, display,
CASE_TEXT[self.case_flags]))
def max_width(self):
return len(self.folded_characters)
def get_required_string(self, reverse):
return 0, self
class Literal(String):
def _dump(self, indent, reverse):
for c in self.characters:
display = ascii(chr(c)).lstrip("bu")
print("{}CHARACTER MATCH {}{}".format(INDENT * indent, display,
CASE_TEXT[self.case_flags]))
class StringSet(RegexBase):
_opcode = {(NOCASE, False): OP.STRING_SET, (IGNORECASE, False):
OP.STRING_SET_IGN, (FULLCASE, False): OP.STRING_SET, (FULLIGNORECASE,
False): OP.STRING_SET_FLD, (NOCASE, True): OP.STRING_SET_REV,
(IGNORECASE, True): OP.STRING_SET_IGN_REV, (FULLCASE, True):
OP.STRING_SET_REV, (FULLIGNORECASE, True): OP.STRING_SET_FLD_REV}
def __init__(self, info, name, case_flags=NOCASE):
self.info = info
self.name = name
self.case_flags = case_flags
self._key = self.__class__, self.name, self.case_flags
self.set_key = (name, self.case_flags)
if self.set_key not in info.named_lists_used:
info.named_lists_used[self.set_key] = len(info.named_lists_used)
def _compile(self, reverse, fuzzy):
index = self.info.named_lists_used[self.set_key]
items = self.info.kwargs[self.name]
case_flags = self.case_flags
if not items:
return []
encoding = self.info.flags & _ALL_ENCODINGS
fold_flags = encoding | case_flags
if fuzzy:
choices = [self._folded(fold_flags, i) for i in items]
# Sort from longest to shortest.
choices.sort(key=lambda s: (-len(s), s))
branches = []
for string in choices:
branches.append(Sequence([Character(c, case_flags=case_flags)
for c in string]))
if len(branches) > 1:
branch = Branch(branches)
else:
branch = branches[0]
branch = branch.optimise(self.info).pack_characters(self.info)
return branch.compile(reverse, fuzzy)
else:
min_len = min(len(i) for i in items)
max_len = max(len(self._folded(fold_flags, i)) for i in items)
return [(self._opcode[case_flags, reverse], index, min_len,
max_len)]
def _dump(self, indent, reverse):
print("{}STRING_SET {}{}".format(INDENT * indent, self.name,
CASE_TEXT[self.case_flags]))
def _folded(self, fold_flags, item):
if isinstance(item, str):
return [ord(c) for c in _regex.fold_case(fold_flags, item)]
else:
return list(item)
def _flatten(self, s):
# Flattens the branches.
if isinstance(s, Branch):
for b in s.branches:
self._flatten(b)
elif isinstance(s, Sequence) and s.items:
seq = s.items
while isinstance(seq[-1], Sequence):
seq[-1 : ] = seq[-1].items
n = 0
while n < len(seq) and isinstance(seq[n], Character):
n += 1
if n > 1:
seq[ : n] = [String([c.value for c in seq[ : n]],
case_flags=self.case_flags)]
self._flatten(seq[-1])
def max_width(self):
if not self.info.kwargs[self.name]:
return 0
if self.case_flags & IGNORECASE:
fold_flags = (self.info.flags & _ALL_ENCODINGS) | self.case_flags
return max(len(_regex.fold_case(fold_flags, i)) for i in
self.info.kwargs[self.name])
else:
return max(len(i) for i in self.info.kwargs[self.name])
class Source:
"Scanner for the regular expression source string."
def __init__(self, string):
if isinstance(string, str):
self.string = string
self.char_type = chr
else:
self.string = string.decode("latin-1")
self.char_type = lambda c: bytes([c])
self.pos = 0
self.ignore_space = False
self.sep = string[ : 0]
def get(self):
string = self.string
pos = self.pos
try:
if self.ignore_space:
while True:
if string[pos].isspace():
# Skip over the whitespace.
pos += 1
elif string[pos] == "#":
# Skip over the comment to the end of the line.
pos = string.index("\n", pos)
else:
break
ch = string[pos]
self.pos = pos + 1
return ch
except IndexError:
# We've reached the end of the string.
self.pos = pos
return string[ : 0]
except ValueError:
# The comment extended to the end of the string.
self.pos = len(string)
return string[ : 0]
def get_many(self, count=1):
string = self.string
pos = self.pos
try:
if self.ignore_space:
substring = []
while len(substring) < count:
while True:
if string[pos].isspace():
# Skip over the whitespace.
pos += 1
elif string[pos] == "#":
# Skip over the comment to the end of the line.
pos = string.index("\n", pos)
else:
break
substring.append(string[pos])
pos += 1
substring = "".join(substring)
else:
substring = string[pos : pos + count]
pos += len(substring)
self.pos = pos
return substring
except IndexError:
# We've reached the end of the string.
self.pos = len(string)
return "".join(substring)
except ValueError:
# The comment extended to the end of the string.
self.pos = len(string)
return "".join(substring)
def get_while(self, test_set, include=True):
string = self.string
pos = self.pos
if self.ignore_space:
try:
substring = []
while True:
if string[pos].isspace():
# Skip over the whitespace.
pos += 1
elif string[pos] == "#":
# Skip over the comment to the end of the line.
pos = string.index("\n", pos)
elif (string[pos] in test_set) == include:
substring.append(string[pos])
pos += 1
else:
break
self.pos = pos
except IndexError:
# We've reached the end of the string.
self.pos = len(string)
except ValueError:
# The comment extended to the end of the string.
self.pos = len(string)
return "".join(substring)
else:
try:
while (string[pos] in test_set) == include:
pos += 1
substring = string[self.pos : pos]
self.pos = pos
return substring
except IndexError:
# We've reached the end of the string.
substring = string[self.pos : pos]
self.pos = pos
return substring
def skip_while(self, test_set, include=True):
string = self.string
pos = self.pos
try:
if self.ignore_space:
while True:
if string[pos].isspace():
# Skip over the whitespace.
pos += 1
elif string[pos] == "#":
# Skip over the comment to the end of the line.
pos = string.index("\n", pos)
elif (string[pos] in test_set) == include:
pos += 1
else:
break
else:
while (string[pos] in test_set) == include:
pos += 1
self.pos = pos
except IndexError:
# We've reached the end of the string.
self.pos = len(string)
except ValueError:
# The comment extended to the end of the string.
self.pos = len(string)
def match(self, substring):
string = self.string
pos = self.pos
if self.ignore_space:
try:
for c in substring:
while True:
if string[pos].isspace():
# Skip over the whitespace.
pos += 1
elif string[pos] == "#":
# Skip over the comment to the end of the line.
pos = string.index("\n", pos)
else:
break
if string[pos] != c:
return False
pos += 1
self.pos = pos
return True
except IndexError:
# We've reached the end of the string.
return False
except ValueError:
# The comment extended to the end of the string.
return False
else:
if not string.startswith(substring, pos):
return False
self.pos = pos + len(substring)
return True
def expect(self, substring):
if not self.match(substring):
raise error("missing {}".format(substring), self.string, self.pos)
def at_end(self):
string = self.string
pos = self.pos
try:
if self.ignore_space:
while True:
if string[pos].isspace():
pos += 1
elif string[pos] == "#":
pos = string.index("\n", pos)
else:
break
return pos >= len(string)
except IndexError:
# We've reached the end of the string.
return True
except ValueError:
# The comment extended to the end of the string.
return True
class Info:
"Info about the regular expression."
def __init__(self, flags=0, char_type=None, kwargs={}):
flags |= DEFAULT_FLAGS[(flags & _ALL_VERSIONS) or DEFAULT_VERSION]
self.flags = flags
self.global_flags = flags
self.inline_locale = False
self.kwargs = kwargs
self.group_count = 0
self.group_index = {}
self.group_name = {}
self.char_type = char_type
self.named_lists_used = {}
self.open_groups = []
self.open_group_count = {}
self.defined_groups = {}
self.group_calls = []
self.private_groups = {}
def open_group(self, name=None):
group = self.group_index.get(name)
if group is None:
while True:
self.group_count += 1
if name is None or self.group_count not in self.group_name:
break
group = self.group_count
if name:
self.group_index[name] = group
self.group_name[group] = name
if group in self.open_groups:
# We have a nested named group. We'll assign it a private group
# number, initially negative until we can assign a proper
# (positive) number.
group_alias = -(len(self.private_groups) + 1)
self.private_groups[group_alias] = group
group = group_alias
self.open_groups.append(group)
self.open_group_count[group] = self.open_group_count.get(group, 0) + 1
return group
def close_group(self):
self.open_groups.pop()
def is_open_group(self, name):
# In version 1, a group reference can refer to an open group. We'll
# just pretend the group isn't open.
version = (self.flags & _ALL_VERSIONS) or DEFAULT_VERSION
if version == VERSION1:
return False
if name.isdigit():
group = int(name)
else:
group = self.group_index.get(name)
return group in self.open_groups
def _check_group_features(info, parsed):
"""Checks whether the reverse and fuzzy features of the group calls match
the groups which they call.
"""
call_refs = {}
additional_groups = []
for call, reverse, fuzzy in info.group_calls:
# Look up the reference of this group call.
key = (call.group, reverse, fuzzy)
ref = call_refs.get(key)
if ref is None:
# This group doesn't have a reference yet, so look up its features.
if call.group == 0:
# Calling the pattern as a whole.
rev = bool(info.flags & REVERSE)
fuz = isinstance(parsed, Fuzzy)
if (rev, fuz) != (reverse, fuzzy):
# The pattern as a whole doesn't have the features we want,
# so we'll need to make a copy of it with the desired
# features.
additional_groups.append((parsed, reverse, fuzzy))
else:
# Calling a capture group.
def_info = info.defined_groups[call.group]
group = def_info[0]
if def_info[1 : ] != (reverse, fuzzy):
# The group doesn't have the features we want, so we'll
# need to make a copy of it with the desired features.
additional_groups.append((group, reverse, fuzzy))
ref = len(call_refs)
call_refs[key] = ref
call.call_ref = ref
info.call_refs = call_refs
info.additional_groups = additional_groups
def _get_required_string(parsed, flags):
"Gets the required string and related info of a parsed pattern."
req_offset, required = parsed.get_required_string(bool(flags & REVERSE))
if required:
required.required = True
if req_offset >= UNLIMITED:
req_offset = -1
req_flags = required.case_flags
if not (flags & UNICODE):
req_flags &= ~UNICODE
req_chars = required.folded_characters
else:
req_offset = 0
req_chars = ()
req_flags = 0
return req_offset, req_chars, req_flags
class Scanner:
def __init__(self, lexicon, flags=0):
self.lexicon = lexicon
# Combine phrases into a compound pattern.
patterns = []
for phrase, action in lexicon:
# Parse the regular expression.
source = Source(phrase)
info = Info(flags, source.char_type)
source.ignore_space = bool(info.flags & VERBOSE)
parsed = _parse_pattern(source, info)
if not source.at_end():
raise error("trailing characters", source.string, source.pos)
# We want to forbid capture groups within each phrase.
patterns.append(parsed.remove_captures())
# Combine all the subpatterns into one pattern.
info = Info(flags)
patterns = [Group(info, g + 1, p) for g, p in enumerate(patterns)]
parsed = Branch(patterns)
# Optimise the compound pattern.
parsed = parsed.optimise(info)
parsed = parsed.pack_characters(info)
# Get the required string.
req_offset, req_chars, req_flags = _get_required_string(parsed,
info.flags)
# Check the features of the groups.
_check_group_features(info, parsed)
# Complain if there are any group calls. They are not supported by the
# Scanner class.
if info.call_refs:
raise error("recursive regex not supported by Scanner",
source.string, source.pos)
reverse = bool(info.flags & REVERSE)
# Compile the compound pattern. The result is a list of tuples.
code = parsed.compile(reverse) + [(OP.SUCCESS, )]
# Flatten the code into a list of ints.
code = _flatten_code(code)
if not parsed.has_simple_start():
# Get the first set, if possible.
try:
fs_code = _compile_firstset(info, parsed.get_firstset(reverse))
fs_code = _flatten_code(fs_code)
code = fs_code + code
except _FirstSetError:
pass
# Check the global flags for conflicts.
version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION
if version not in (0, VERSION0, VERSION1):
raise ValueError("VERSION0 and VERSION1 flags are mutually incompatible")
# Create the PatternObject.
#
# Local flags like IGNORECASE affect the code generation, but aren't
# needed by the PatternObject itself. Conversely, global flags like
# LOCALE _don't_ affect the code generation but _are_ needed by the
# PatternObject.
self.scanner = _regex.compile(None, (flags & GLOBAL_FLAGS) | version,
code, {}, {}, {}, [], req_offset, req_chars, req_flags,
len(patterns))
def scan(self, string):
result = []
append = result.append
match = self.scanner.scanner(string).match
i = 0
while True:
m = match()
if not m:
break
j = m.end()
if i == j:
break
action = self.lexicon[m.lastindex - 1][1]
if hasattr(action, '__call__'):
self.match = m
action = action(self, m.group())
if action is not None:
append(action)
i = j
return result, string[i : ]
# Get the known properties dict.
PROPERTIES = _regex.get_properties()
# Build the inverse of the properties dict.
PROPERTY_NAMES = {}
for prop_name, (prop_id, values) in PROPERTIES.items():
name, prop_values = PROPERTY_NAMES.get(prop_id, ("", {}))
name = max(name, prop_name, key=len)
PROPERTY_NAMES[prop_id] = name, prop_values
for val_name, val_id in values.items():
prop_values[val_id] = max(prop_values.get(val_id, ""), val_name,
key=len)
# Character escape sequences.
CHARACTER_ESCAPES = {
"a": "\a",
"b": "\b",
"f": "\f",
"n": "\n",
"r": "\r",
"t": "\t",
"v": "\v",
}
# Predefined character set escape sequences.
CHARSET_ESCAPES = {
"d": lookup_property(None, "Digit", True),
"D": lookup_property(None, "Digit", False),
"s": lookup_property(None, "Space", True),
"S": lookup_property(None, "Space", False),
"w": lookup_property(None, "Word", True),
"W": lookup_property(None, "Word", False),
}
# Positional escape sequences.
POSITION_ESCAPES = {
"A": StartOfString(),
"b": Boundary(),
"B": Boundary(False),
"m": StartOfWord(),
"M": EndOfWord(),
"Z": EndOfString(),
}
# Positional escape sequences when WORD flag set.
WORD_POSITION_ESCAPES = dict(POSITION_ESCAPES)
WORD_POSITION_ESCAPES.update({
"b": DefaultBoundary(),
"B": DefaultBoundary(False),
"m": DefaultStartOfWord(),
"M": DefaultEndOfWord(),
})
| ajibawa-2023/Python-Code-Large/train/row_1389 | 2,422 | 4,125 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Import_L16_C0", "label": "string import string", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0039, 0.0002, 0, 0.66, 0.0, 890, 0, 1, 0, 0, 890, 0, 0], "semantic": {"name": "string", "arg_names": [], "import_names": ["string"], "rhs_call_name": "", "annotation": ""}, "snippet": "import string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Import_L17_C0", "label": "sys import sys", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0041, 0.0002, 0, 0.66, 0.0052, 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_1389:Import_L18_C0", "label": "unicodedata import unicodedata", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0044, 0.0002, 0, 0.66, 0.0104, 759, 0, 1, 0, 0, 759, 0, 0], "semantic": {"name": "unicodedata", "arg_names": [], "import_names": ["unicodedata"], "rhs_call_name": "", "annotation": ""}, "snippet": "import unicodedata"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ImportFrom_L19_C0", "label": "from collections import defaultdict", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0046, 0.0002, 0, 0.66, 0.0155, 193, 0, 1, 0, 0, 193, 0, 0], "semantic": {"name": "collections", "arg_names": [], "import_names": ["defaultdict"], "rhs_call_name": "", "annotation": ""}, "snippet": "from collections import defaultdict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Import_L21_C0", "label": "_regex import _regex", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0051, 0.0002, 0, 0.66, 0.0207, 136, 0, 1, 0, 0, 136, 0, 0], "semantic": {"name": "_regex", "arg_names": [], "import_names": ["_regex"], "rhs_call_name": "", "annotation": ""}, "snippet": "import _regex"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L23_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [23, 27], "level": 0, "parent": null, "vector": [14, 0, 0.0061, 0.0012, 0, 0.66, 0.0259, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = [\"A\", \"ASCII\", \"B\", \"BESTMATCH\", \"D\", \"DEBUG\", \"E\", \"ENHANCEMATCH\",\n \"F\", \"FULLCASE\", \"I\", \"IGNORECASE\", \"L\", \"LOCALE\", \"M\", \"MULTILINE\", \"R\",\n \"REVERSE\", \"S\", \"DOTALL\", \"T\", \"TEMPLATE\", \"U\", \"UNICODE\", \"V0\", \"VERSION0\",\n \"V1\", \"VERSION1\", \"W\", \"WORD\", \"X\", \"VERBOSE\", \"error\",\n \"Scanner\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L30_C0", "label": "error", "type": "class", "loc": [30, 46], "level": 0, "parent": null, "vector": [3, 0, 0.0092, 0.0041, 0, 0.66, 0.0311, 771, 0, 1, 0, 0, 645, 0, 6], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class error(Exception):\n def __init__(self, message, pattern=None, pos=None):\n newline = '\\n' if isinstance(pattern, str) else b'\\n'\n self.msg = message\n self.pattern = pattern\n self.pos = pos\n if pattern is not None and pos is not None:\n self.lineno = pattern.count(newline, 0, pos) + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L31_C4", "label": "__init__", "type": "function", "loc": [31, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L30_C0", "vector": [2, 1, 0.0093, 0.0039, 1, 0.6, 0.0, 555, 0, 4, 0, 0, 0, 0, 6], "semantic": {"name": "__init__", "arg_names": ["self", "message", "pattern", "pos"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, message, pattern=None, pos=None):\n newline = '\\n' if isinstance(pattern, str) else b'\\n'\n self.msg = message\n self.pattern = pattern\n self.pos = pos\n if pattern is not None and pos is not None:\n self.lineno = pattern.count(newline, 0, pos) + 1\n self.colno = pos - pattern.rfind(newline, 0, pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L32_C8", "label": "newline =", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L31_C4", "vector": [14, 2, 0.0078, 0.0002, 2, 0.72, 0.0, 719, 8, 0, 0, 0, 0, 0, 1], "semantic": {"name": "newline", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline = '\\n' if isinstance(pattern, str) else b'\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L33_C8", "label": "self.msg =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L31_C4", "vector": [14, 2, 0.008, 0.0002, 2, 0.72, 0.2, 528, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.msg = message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L34_C8", "label": "self.pattern =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L31_C4", "vector": [14, 2, 0.0082, 0.0002, 2, 0.72, 0.4, 541, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.pattern", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pattern = pattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L35_C8", "label": "self.pos =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L31_C4", "vector": [14, 2, 0.0085, 0.0002, 2, 0.72, 0.6, 283, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pos = pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L36_C8", "label": "if", "type": "if", "loc": [36, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L31_C4", "vector": [4, 2, 0.0097, 0.0022, 2, 0.72, 0.8, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pattern is not None and pos is not None:\n self.lineno = pattern.count(newline, 0, pos) + 1\n self.colno = pos - pattern.rfind(newline, 0, pos)\n\n message = \"{} at position {}\".format(message, pos)\n\n if newline in pattern:\n message += \" (line {}, column {})\".format(self.lineno,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L37_C12", "label": "self.lineno =", "type": "assigned_variable", "loc": [37, 37], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L36_C8", "vector": [14, 3, 0.009, 0.0002, 3, 0.84, 0.0, 66, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.lineno", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.lineno = pattern.count(newline, 0, pos) + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L38_C12", "label": "self.colno =", "type": "assigned_variable", "loc": [38, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L36_C8", "vector": [14, 3, 0.0092, 0.0002, 3, 0.84, 0.3333, 969, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.colno", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.colno = pos - pattern.rfind(newline, 0, pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L40_C12", "label": "message = format()", "type": "assigned_variable", "loc": [40, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L36_C8", "vector": [14, 3, 0.0097, 0.0002, 3, 0.84, 0.6667, 635, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "format", "annotation": ""}, "snippet": " message = \"{} at position {}\".format(message, pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L42_C12", "label": "if", "type": "if", "loc": [42, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L36_C8", "vector": [4, 3, 0.0104, 0.0007, 3, 0.84, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if newline in pattern:\n message += \" (line {}, column {})\".format(self.lineno,\n self.colno)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L46_C8", "label": "__init__()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L31_C4", "vector": [8, 2, 0.0112, 0.0002, 2, 0.72, 1.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Exception.__init__(self, message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L50_C0", "label": "_UnscopedFlagSet", "type": "class", "loc": [50, 51], "level": 0, "parent": null, "vector": [3, 0, 0.0122, 0.0005, 0, 0.66, 0.0363, 262, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "_UnscopedFlagSet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class _UnscopedFlagSet(Exception):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L54_C0", "label": "ParseError", "type": "class", "loc": [54, 55], "level": 0, "parent": null, "vector": [3, 0, 0.0132, 0.0005, 0, 0.66, 0.0415, 260, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "ParseError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ParseError(Exception):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L58_C0", "label": "_FirstSetError", "type": "class", "loc": [58, 59], "level": 0, "parent": null, "vector": [3, 0, 0.0142, 0.0005, 0, 0.66, 0.0466, 446, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "_FirstSetError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class _FirstSetError(Exception):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L62_C0", "label": "A =", "type": "assigned_variable", "loc": [62, 62], "level": 0, "parent": null, "vector": [14, 0, 0.015, 0.0002, 0, 0.66, 0.0518, 429, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "A", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "A = ASCII = 0x80 # Assume ASCII locale."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L63_C0", "label": "B =", "type": "assigned_variable", "loc": [63, 63], "level": 0, "parent": null, "vector": [14, 0, 0.0153, 0.0002, 0, 0.66, 0.057, 197, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "B", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "B = BESTMATCH = 0x1000 # Best fuzzy match."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L64_C0", "label": "D =", "type": "assigned_variable", "loc": [64, 64], "level": 0, "parent": null, "vector": [14, 0, 0.0155, 0.0002, 0, 0.66, 0.0622, 939, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "D", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "D = DEBUG = 0x200 # Print parsed pattern."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L65_C0", "label": "E =", "type": "assigned_variable", "loc": [65, 65], "level": 0, "parent": null, "vector": [14, 0, 0.0158, 0.0002, 0, 0.66, 0.0674, 76, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "E", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "E = ENHANCEMATCH = 0x8000 # Attempt to improve the fit after finding the first"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L67_C0", "label": "F =", "type": "assigned_variable", "loc": [67, 67], "level": 0, "parent": null, "vector": [14, 0, 0.0162, 0.0002, 0, 0.66, 0.0725, 498, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "F", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "F = FULLCASE = 0x4000 # Unicode full case-folding."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L68_C0", "label": "I =", "type": "assigned_variable", "loc": [68, 68], "level": 0, "parent": null, "vector": [14, 0, 0.0165, 0.0002, 0, 0.66, 0.0777, 134, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "I", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "I = IGNORECASE = 0x2 # Ignore case."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L69_C0", "label": "L =", "type": "assigned_variable", "loc": [69, 69], "level": 0, "parent": null, "vector": [14, 0, 0.0167, 0.0002, 0, 0.66, 0.0829, 714, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "L", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "L = LOCALE = 0x4 # Assume current 8-bit locale."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L70_C0", "label": "M =", "type": "assigned_variable", "loc": [70, 70], "level": 0, "parent": null, "vector": [14, 0, 0.017, 0.0002, 0, 0.66, 0.0881, 727, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "M", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "M = MULTILINE = 0x8 # Make anchors look for newline."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L71_C0", "label": "R =", "type": "assigned_variable", "loc": [71, 71], "level": 0, "parent": null, "vector": [14, 0, 0.0172, 0.0002, 0, 0.66, 0.0933, 467, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "R", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "R = REVERSE = 0x400 # Search backwards."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L72_C0", "label": "S =", "type": "assigned_variable", "loc": [72, 72], "level": 0, "parent": null, "vector": [14, 0, 0.0175, 0.0002, 0, 0.66, 0.0984, 514, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "S", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "S = DOTALL = 0x10 # Make dot match newline."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L73_C0", "label": "U =", "type": "assigned_variable", "loc": [73, 73], "level": 0, "parent": null, "vector": [14, 0, 0.0177, 0.0002, 0, 0.66, 0.1036, 643, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "U", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "U = UNICODE = 0x20 # Assume Unicode locale."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L74_C0", "label": "V0 =", "type": "assigned_variable", "loc": [74, 74], "level": 0, "parent": null, "vector": [14, 0, 0.0179, 0.0002, 0, 0.66, 0.1088, 726, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "V0", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "V0 = VERSION0 = 0x2000 # Old legacy behaviour."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L75_C0", "label": "V1 =", "type": "assigned_variable", "loc": [75, 75], "level": 0, "parent": null, "vector": [14, 0, 0.0182, 0.0002, 0, 0.66, 0.114, 79, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "V1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "V1 = VERSION1 = 0x100 # New enhanced behaviour."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L76_C0", "label": "W =", "type": "assigned_variable", "loc": [76, 76], "level": 0, "parent": null, "vector": [14, 0, 0.0184, 0.0002, 0, 0.66, 0.1192, 94, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "W", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "W = WORD = 0x800 # Default Unicode word breaks."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L77_C0", "label": "X =", "type": "assigned_variable", "loc": [77, 77], "level": 0, "parent": null, "vector": [14, 0, 0.0187, 0.0002, 0, 0.66, 0.1244, 783, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "X", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "X = VERBOSE = 0x40 # Ignore whitespace and comments."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L78_C0", "label": "T =", "type": "assigned_variable", "loc": [78, 78], "level": 0, "parent": null, "vector": [14, 0, 0.0189, 0.0002, 0, 0.66, 0.1295, 716, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "T", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "T = TEMPLATE = 0x1 # Template (present because re module has it)."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L80_C0", "label": "DEFAULT_VERSION =", "type": "assigned_variable", "loc": [80, 80], "level": 0, "parent": null, "vector": [14, 0, 0.0194, 0.0002, 0, 0.66, 0.1347, 455, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "DEFAULT_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEFAULT_VERSION = VERSION1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L82_C0", "label": "_ALL_VERSIONS =", "type": "assigned_variable", "loc": [82, 82], "level": 0, "parent": null, "vector": [14, 0, 0.0199, 0.0002, 0, 0.66, 0.1399, 719, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_ALL_VERSIONS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_ALL_VERSIONS = VERSION0 | VERSION1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L83_C0", "label": "_ALL_ENCODINGS =", "type": "assigned_variable", "loc": [83, 83], "level": 0, "parent": null, "vector": [14, 0, 0.0201, 0.0002, 0, 0.66, 0.1451, 725, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_ALL_ENCODINGS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_ALL_ENCODINGS = ASCII | LOCALE | UNICODE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L86_C0", "label": "DEFAULT_FLAGS =", "type": "assigned_variable", "loc": [86, 86], "level": 0, "parent": null, "vector": [14, 0, 0.0208, 0.0002, 0, 0.66, 0.1503, 795, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "DEFAULT_FLAGS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEFAULT_FLAGS = {VERSION0: 0, VERSION1: FULLCASE}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L89_C0", "label": "GLOBAL_FLAGS =", "type": "assigned_variable", "loc": [89, 90], "level": 0, "parent": null, "vector": [14, 0, 0.0217, 0.0005, 0, 0.66, 0.1554, 20, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "GLOBAL_FLAGS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "GLOBAL_FLAGS = (_ALL_ENCODINGS | _ALL_VERSIONS | BESTMATCH | DEBUG |\n ENHANCEMATCH | REVERSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L91_C0", "label": "SCOPED_FLAGS =", "type": "assigned_variable", "loc": [91, 91], "level": 0, "parent": null, "vector": [14, 0, 0.0221, 0.0002, 0, 0.66, 0.1606, 953, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "SCOPED_FLAGS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SCOPED_FLAGS = FULLCASE | IGNORECASE | MULTILINE | DOTALL | WORD | VERBOSE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L93_C0", "label": "ALPHA = frozenset()", "type": "assigned_variable", "loc": [93, 93], "level": 0, "parent": null, "vector": [14, 0, 0.0225, 0.0002, 0, 0.66, 0.1658, 565, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "ALPHA", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": "ALPHA = frozenset(string.ascii_letters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L94_C0", "label": "DIGITS = frozenset()", "type": "assigned_variable", "loc": [94, 94], "level": 0, "parent": null, "vector": [14, 0, 0.0228, 0.0002, 0, 0.66, 0.171, 100, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "DIGITS", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": "DIGITS = frozenset(string.digits)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L95_C0", "label": "ALNUM =", "type": "assigned_variable", "loc": [95, 95], "level": 0, "parent": null, "vector": [14, 0, 0.023, 0.0002, 0, 0.66, 0.1762, 304, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ALNUM", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ALNUM = ALPHA | DIGITS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L96_C0", "label": "OCT_DIGITS = frozenset()", "type": "assigned_variable", "loc": [96, 96], "level": 0, "parent": null, "vector": [14, 0, 0.0233, 0.0002, 0, 0.66, 0.1813, 63, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "OCT_DIGITS", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": "OCT_DIGITS = frozenset(string.octdigits)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L97_C0", "label": "HEX_DIGITS = frozenset()", "type": "assigned_variable", "loc": [97, 97], "level": 0, "parent": null, "vector": [14, 0, 0.0235, 0.0002, 0, 0.66, 0.1865, 251, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "HEX_DIGITS", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": "HEX_DIGITS = frozenset(string.hexdigits)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L98_C0", "label": "SPECIAL_CHARS =", "type": "assigned_variable", "loc": [98, 98], "level": 0, "parent": null, "vector": [14, 0, 0.0238, 0.0002, 0, 0.66, 0.1917, 881, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "SPECIAL_CHARS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SPECIAL_CHARS = frozenset(\"()|?*+{^$.[\\\\#\") | frozenset([\"\"])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L99_C0", "label": "NAMED_CHAR_PART =", "type": "assigned_variable", "loc": [99, 99], "level": 0, "parent": null, "vector": [14, 0, 0.024, 0.0002, 0, 0.66, 0.1969, 87, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "NAMED_CHAR_PART", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "NAMED_CHAR_PART = ALNUM | frozenset(\" -\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L100_C0", "label": "PROPERTY_NAME_PART =", "type": "assigned_variable", "loc": [100, 100], "level": 0, "parent": null, "vector": [14, 0, 0.0242, 0.0002, 0, 0.66, 0.2021, 99, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "PROPERTY_NAME_PART", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "PROPERTY_NAME_PART = ALNUM | frozenset(\" &_-.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L101_C0", "label": "SET_OPS =", "type": "assigned_variable", "loc": [101, 101], "level": 0, "parent": null, "vector": [14, 0, 0.0245, 0.0002, 0, 0.66, 0.2073, 825, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "SET_OPS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SET_OPS = (\"||\", \"~~\", \"&&\", \"--\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L104_C0", "label": "BYTES_PER_CODE = get_code_size()", "type": "assigned_variable", "loc": [104, 104], "level": 0, "parent": null, "vector": [14, 0, 0.0252, 0.0002, 0, 0.66, 0.2124, 264, 3, 0, 0, 0, 319, 10, 1], "semantic": {"name": "BYTES_PER_CODE", "arg_names": [], "import_names": [], "rhs_call_name": "get_code_size", "annotation": ""}, "snippet": "BYTES_PER_CODE = _regex.get_code_size()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L105_C0", "label": "BITS_PER_CODE =", "type": "assigned_variable", "loc": [105, 105], "level": 0, "parent": null, "vector": [14, 0, 0.0255, 0.0002, 0, 0.66, 0.2176, 710, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "BITS_PER_CODE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "BITS_PER_CODE = BYTES_PER_CODE * 8"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L108_C0", "label": "UNLIMITED =", "type": "assigned_variable", "loc": [108, 108], "level": 0, "parent": null, "vector": [14, 0, 0.0262, 0.0002, 0, 0.66, 0.2228, 661, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "UNLIMITED", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "UNLIMITED = (1 << BITS_PER_CODE) - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L111_C0", "label": "REGEX_FLAGS =", "type": "assigned_variable", "loc": [111, 113], "level": 0, "parent": null, "vector": [14, 0, 0.0272, 0.0007, 0, 0.66, 0.228, 624, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "REGEX_FLAGS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "REGEX_FLAGS = {\"a\": ASCII, \"b\": BESTMATCH, \"e\": ENHANCEMATCH, \"f\": FULLCASE,\n \"i\": IGNORECASE, \"L\": LOCALE, \"m\": MULTILINE, \"r\": REVERSE, \"s\": DOTALL, \"u\":\n UNICODE, \"V0\": VERSION0, \"V1\": VERSION1, \"w\": WORD, \"x\": VERBOSE}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L116_C0", "label": "CASE_FLAGS =", "type": "assigned_variable", "loc": [116, 116], "level": 0, "parent": null, "vector": [14, 0, 0.0281, 0.0002, 0, 0.66, 0.2332, 212, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "CASE_FLAGS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "CASE_FLAGS = FULLCASE | IGNORECASE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L117_C0", "label": "NOCASE =", "type": "assigned_variable", "loc": [117, 117], "level": 0, "parent": null, "vector": [14, 0, 0.0284, 0.0002, 0, 0.66, 0.2383, 784, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "NOCASE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "NOCASE = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L118_C0", "label": "FULLIGNORECASE =", "type": "assigned_variable", "loc": [118, 118], "level": 0, "parent": null, "vector": [14, 0, 0.0286, 0.0002, 0, 0.66, 0.2435, 217, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "FULLIGNORECASE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "FULLIGNORECASE = FULLCASE | IGNORECASE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L120_C0", "label": "FULL_CASE_FOLDING =", "type": "assigned_variable", "loc": [120, 120], "level": 0, "parent": null, "vector": [14, 0, 0.0291, 0.0002, 0, 0.66, 0.2487, 187, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "FULL_CASE_FOLDING", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "FULL_CASE_FOLDING = UNICODE | FULLIGNORECASE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L123_C0", "label": "HEX_ESCAPES =", "type": "assigned_variable", "loc": [123, 123], "level": 0, "parent": null, "vector": [14, 0, 0.0298, 0.0002, 0, 0.66, 0.2539, 360, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "HEX_ESCAPES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "HEX_ESCAPES = {\"x\": 2, \"u\": 4, \"U\": 8}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L126_C0", "label": "COMMENT = object()", "type": "assigned_variable", "loc": [126, 126], "level": 0, "parent": null, "vector": [14, 0, 0.0305, 0.0002, 0, 0.66, 0.2591, 673, 3, 0, 0, 0, 186, 10, 1], "semantic": {"name": "COMMENT", "arg_names": [], "import_names": [], "rhs_call_name": "object", "annotation": ""}, "snippet": "COMMENT = object()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L127_C0", "label": "FLAGS = object()", "type": "assigned_variable", "loc": [127, 127], "level": 0, "parent": null, "vector": [14, 0, 0.0308, 0.0002, 0, 0.66, 0.2642, 578, 3, 0, 0, 0, 186, 10, 1], "semantic": {"name": "FLAGS", "arg_names": [], "import_names": [], "rhs_call_name": "object", "annotation": ""}, "snippet": "FLAGS = object()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L130_C0", "label": "OPCODES =", "type": "assigned_variable", "loc": [130, 213], "level": 0, "parent": null, "vector": [14, 0, 0.0416, 0.0204, 0, 0.66, 0.2694, 532, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "OPCODES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "OPCODES = \"\"\"\nFAILURE\nSUCCESS\nANY\nANY_ALL\nANY_ALL_REV\nANY_REV\nANY_U"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L216_C0", "label": "Namespace", "type": "class", "loc": [216, 217], "level": 0, "parent": null, "vector": [3, 0, 0.0525, 0.0005, 0, 0.66, 0.2746, 283, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Namespace", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Namespace:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L219_C0", "label": "OP = Namespace()", "type": "assigned_variable", "loc": [219, 219], "level": 0, "parent": null, "vector": [14, 0, 0.0531, 0.0002, 0, 0.66, 0.2798, 242, 3, 0, 0, 0, 283, 10, 1], "semantic": {"name": "OP", "arg_names": [], "import_names": [], "rhs_call_name": "Namespace", "annotation": ""}, "snippet": "OP = Namespace()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L220_C0", "label": "for i, op", "type": "for", "loc": [220, 221], "level": 0, "parent": null, "vector": [6, 0, 0.0535, 0.0005, 0, 0.66, 0.285, 350, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i, op", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i, op in enumerate(OPCODES.split()):\n setattr(OP, op, i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L221_C4", "label": "setattr()", "type": "expression", "loc": [221, 221], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L220_C0", "vector": [8, 1, 0.0536, 0.0002, 1, 0.26, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(OP, op, i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "label": "_shrink_cache", "type": "function", "loc": [223, 271], "level": 0, "parent": null, "vector": [2, 0, 0.0599, 0.0119, 0, 0.66, 0.2902, 717, 0, 5, 0, 0, 0, 0, 8], "semantic": {"name": "_shrink_cache", "arg_names": ["cache_dict", "args_dict", "locale_sensitive", "max_length", "divisor"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _shrink_cache(cache_dict, args_dict, locale_sensitive, max_length, divisor=5):\n \"\"\"Make room in the given cache.\n\n Args:\n cache_dict: The cache dictionary to modify.\n args_dict: The dictionary of named list args used by patterns.\n max_length: Maximum # of entries in cache_dict before it is shrunk.\n divisor: Cache will shrink to max_length - 1/divisor*max_length items."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L224_C4", "label": "expression", "type": "expression", "loc": [224, 231], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "vector": [8, 1, 0.0552, 0.0019, 1, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Make room in the given cache.\n\n Args:\n cache_dict: The cache dictionary to modify.\n args_dict: The dictionary of named list args used by patterns.\n max_length: Maximum # of entries in cache_dict before it is shrunk.\n divisor: Cache will shrink to max_length - 1/divisor*max_length items.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L237_C4", "label": "cache_keys = tuple()", "type": "assigned_variable", "loc": [237, 237], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "vector": [14, 1, 0.0575, 0.0002, 1, 0.39, 0.0833, 191, 3, 1, 0, 0, 259, 10, 2], "semantic": {"name": "cache_keys", "arg_names": [], "import_names": [], "rhs_call_name": "tuple", "annotation": ""}, "snippet": " cache_keys = tuple(cache_dict.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L238_C4", "label": "overage =", "type": "assigned_variable", "loc": [238, 238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "vector": [14, 1, 0.0577, 0.0002, 1, 0.39, 0.1667, 161, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "overage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " overage = len(cache_keys) - max_length"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L239_C4", "label": "if", "type": "if", "loc": [239, 242], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "vector": [4, 1, 0.0583, 0.001, 1, 0.39, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if overage < 0:\n # Cache is already within limits. Normally this should not happen\n # but it could due to multithreading.\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L242_C8", "label": "return", "type": "return", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L239_C4", "vector": [13, 2, 0.0587, 0.0002, 2, 0.33, 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_1389:Assign_L244_C4", "label": "number_to_toss =", "type": "assigned_variable", "loc": [244, 244], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "vector": [14, 1, 0.0592, 0.0002, 1, 0.39, 0.3333, 212, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "number_to_toss", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " number_to_toss = max_length // divisor + overage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Import_L247_C4", "label": "random import random", "type": "import", "loc": [247, 247], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "vector": [1, 1, 0.0599, 0.0002, 1, 0.39, 0.4167, 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_1389:If_L248_C4", "label": "if", "type": "if", "loc": [248, 251], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "vector": [4, 1, 0.0605, 0.001, 1, 0.39, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hasattr(random, 'sample'):\n # Do nothing while resolving the circular dependency:\n # re->random->warnings->tokenize->string->re\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L251_C8", "label": "return", "type": "return", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L248_C4", "vector": [13, 2, 0.0608, 0.0002, 2, 0.43, 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_1389:For_L253_C4", "label": "for doomed_key", "type": "for", "loc": [253, 258], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "vector": [6, 1, 0.0619, 0.0015, 1, 0.39, 0.5833, 335, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "doomed_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for doomed_key in random.sample(cache_keys, number_to_toss):\n try:\n del cache_dict[doomed_key]\n except KeyError:\n # Ignore problems if the cache changed from another thread.\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L254_C8", "label": "try", "type": "try", "loc": [254, 258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L253_C4", "vector": [7, 2, 0.0621, 0.0012, 2, 0.95, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n del cache_dict[doomed_key]\n except KeyError:\n # Ignore problems if the cache changed from another thread.\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L261_C4", "label": "clear()", "type": "expression", "loc": [261, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "vector": [8, 1, 0.0633, 0.0002, 1, 0.39, 0.6667, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " args_dict.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L262_C4", "label": "sensitivity_dict =", "type": "assigned_variable", "loc": [262, 262], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "vector": [14, 1, 0.0635, 0.0002, 1, 0.39, 0.75, 92, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "sensitivity_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sensitivity_dict = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L263_C4", "label": "for pattern, pattern_type, flags, args, default_version, locale", "type": "for", "loc": [263, 268], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "vector": [6, 1, 0.0644, 0.0015, 1, 0.39, 0.8333, 180, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pattern, pattern_type, flags, args, default_version, locale", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for pattern, pattern_type, flags, args, default_version, locale in cache_dict:\n args_dict[pattern, pattern_type, flags, default_version, locale] = args\n try:\n sensitivity_dict[pattern_type, pattern] = locale_sensitive[pattern_type, pattern]\n except KeyError:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L264_C8", "label": "assign", "type": "assigned_variable", "loc": [264, 264], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L263_C4", "vector": [14, 2, 0.064, 0.0002, 2, 0.61, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args_dict[pattern, pattern_type, flags, default_version, locale] = args"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L265_C8", "label": "try", "type": "try", "loc": [265, 268], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L263_C4", "vector": [7, 2, 0.0646, 0.001, 2, 0.61, 1.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n sensitivity_dict[pattern_type, pattern] = locale_sensitive[pattern_type, pattern]\n except KeyError:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L266_C12", "label": "assign", "type": "assigned_variable", "loc": [266, 266], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L265_C8", "vector": [14, 3, 0.0645, 0.0002, 3, 0.21, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sensitivity_dict[pattern_type, pattern] = locale_sensitive[pattern_type, pattern]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L270_C4", "label": "clear()", "type": "expression", "loc": [270, 270], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "vector": [8, 1, 0.0655, 0.0002, 1, 0.39, 0.9167, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " locale_sensitive.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L271_C4", "label": "update()", "type": "expression", "loc": [271, 271], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "vector": [8, 1, 0.0657, 0.0002, 1, 0.39, 1.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " locale_sensitive.update(sensitivity_dict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L273_C0", "label": "_fold_case", "type": "function", "loc": [273, 279], "level": 0, "parent": null, "vector": [2, 0, 0.0669, 0.0017, 0, 0.66, 0.2953, 604, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "_fold_case", "arg_names": ["info", "string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _fold_case(info, string):\n \"Folds the case of a string.\"\n flags = info.flags\n if (flags & _ALL_ENCODINGS) == 0:\n flags |= info.guess_encoding\n\n return _regex.fold_case(flags, string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L274_C4", "label": "expression", "type": "expression", "loc": [274, 274], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L273_C0", "vector": [8, 1, 0.0664, 0.0002, 1, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Folds the case of a string.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L275_C4", "label": "flags =", "type": "assigned_variable", "loc": [275, 275], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L273_C0", "vector": [14, 1, 0.0667, 0.0002, 1, 0.81, 0.3333, 375, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " flags = info.flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L276_C4", "label": "if", "type": "if", "loc": [276, 277], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L273_C0", "vector": [4, 1, 0.067, 0.0005, 1, 0.81, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (flags & _ALL_ENCODINGS) == 0:\n flags |= info.guess_encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L279_C4", "label": "return", "type": "return", "loc": [279, 279], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L273_C0", "vector": [13, 1, 0.0676, 0.0002, 1, 0.81, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _regex.fold_case(flags, string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L281_C0", "label": "is_cased", "type": "function", "loc": [281, 283], "level": 0, "parent": null, "vector": [2, 0, 0.0684, 0.0007, 0, 0.66, 0.3005, 446, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "is_cased", "arg_names": ["info", "char"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_cased(info, char):\n \"Checks whether a character is cased.\"\n return len(_regex.get_all_cases(info.flags, char)) > 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L282_C4", "label": "expression", "type": "expression", "loc": [282, 282], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L281_C0", "vector": [8, 1, 0.0684, 0.0002, 1, 0.01, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Checks whether a character is cased.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L283_C4", "label": "return", "type": "return", "loc": [283, 283], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L281_C0", "vector": [13, 1, 0.0686, 0.0002, 1, 0.01, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(_regex.get_all_cases(info.flags, char)) > 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L285_C0", "label": "_compile_firstset", "type": "function", "loc": [285, 307], "level": 0, "parent": null, "vector": [2, 0, 0.0718, 0.0056, 0, 0.66, 0.3057, 346, 0, 2, 1, 0, 0, 0, 11], "semantic": {"name": "_compile_firstset", "arg_names": ["info", "fs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _compile_firstset(info, fs):\n \"Compiles the firstset for the pattern.\"\n if not fs or None in fs:\n return []\n\n # If we ignore the case, for simplicity we won't build a firstset.\n members = set()\n for i in fs:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L286_C4", "label": "expression", "type": "expression", "loc": [286, 286], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L285_C0", "vector": [8, 1, 0.0693, 0.0002, 1, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Compiles the firstset for the pattern.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L287_C4", "label": "if", "type": "if", "loc": [287, 288], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L285_C0", "vector": [4, 1, 0.0697, 0.0005, 1, 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 fs or None in fs:\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L288_C8", "label": "return", "type": "return", "loc": [288, 288], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L287_C4", "vector": [13, 2, 0.0698, 0.0002, 2, 0.93, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L291_C4", "label": "members = set()", "type": "assigned_variable", "loc": [291, 291], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L285_C0", "vector": [14, 1, 0.0705, 0.0002, 1, 0.99, 0.3333, 573, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "members", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " members = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L292_C4", "label": "for i", "type": "for", "loc": [292, 300], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L285_C0", "vector": [6, 1, 0.0718, 0.0022, 1, 0.99, 0.5, 826, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in fs:\n if i.case_flags:\n if isinstance(i, Character):\n if is_cased(info, i.value):\n return []\n elif isinstance(i, SetBase):\n return []\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L293_C8", "label": "if", "type": "if", "loc": [293, 298], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L292_C4", "vector": [4, 2, 0.0716, 0.0015, 2, 0.92, 0.0, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i.case_flags:\n if isinstance(i, Character):\n if is_cased(info, i.value):\n return []\n elif isinstance(i, SetBase):\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L294_C12", "label": "if", "type": "if", "loc": [294, 298], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L293_C8", "vector": [4, 3, 0.0718, 0.0012, 3, 0.57, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(i, Character):\n if is_cased(info, i.value):\n return []\n elif isinstance(i, SetBase):\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L295_C16", "label": "if", "type": "if", "loc": [295, 296], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L294_C12", "vector": [4, 4, 0.0716, 0.0005, 4, 0.21, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if is_cased(info, i.value):\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L296_C20", "label": "return", "type": "return", "loc": [296, 296], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L295_C16", "vector": [13, 5, 0.0718, 0.0002, 5, 0.79, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L297_C12", "label": "if", "type": "if", "loc": [297, 298], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L294_C12", "vector": [4, 4, 0.0721, 0.0005, 4, 0.21, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(i, SetBase):\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L298_C16", "label": "return", "type": "return", "loc": [298, 298], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L297_C12", "vector": [13, 5, 0.0722, 0.0002, 5, 0.41, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L300_C8", "label": "add()", "type": "expression", "loc": [300, 300], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L292_C4", "vector": [8, 2, 0.0727, 0.0002, 2, 0.92, 1.0, 241, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " members.add(i.with_flags(case_flags=NOCASE))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L303_C4", "label": "fs = SetUnion()", "type": "assigned_variable", "loc": [303, 303], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L285_C0", "vector": [14, 1, 0.0735, 0.0002, 1, 0.99, 0.6667, 245, 3, 3, 0, 0, 489, 10, 2], "semantic": {"name": "fs", "arg_names": [], "import_names": [], "rhs_call_name": "SetUnion", "annotation": ""}, "snippet": " fs = SetUnion(info, list(members), zerowidth=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L304_C4", "label": "fs = optimise()", "type": "assigned_variable", "loc": [304, 304], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L285_C0", "vector": [14, 1, 0.0737, 0.0002, 1, 0.99, 0.8333, 245, 3, 2, 0, 0, 265, 10, 1], "semantic": {"name": "fs", "arg_names": [], "import_names": [], "rhs_call_name": "optimise", "annotation": ""}, "snippet": " fs = fs.optimise(info, in_set=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L307_C4", "label": "return", "type": "return", "loc": [307, 307], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L285_C0", "vector": [13, 1, 0.0744, 0.0002, 1, 0.99, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return fs.compile(bool(info.flags & REVERSE))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L309_C0", "label": "_flatten_code", "type": "function", "loc": [309, 315], "level": 0, "parent": null, "vector": [2, 0, 0.0756, 0.0017, 0, 0.66, 0.3109, 863, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "_flatten_code", "arg_names": ["code"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _flatten_code(code):\n \"Flattens the code from a list of tuples.\"\n flat_code = []\n for c in code:\n flat_code.extend(c)\n\n return flat_code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L310_C4", "label": "expression", "type": "expression", "loc": [310, 310], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L309_C0", "vector": [8, 1, 0.0752, 0.0002, 1, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Flattens the code from a list of tuples.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L311_C4", "label": "flat_code =", "type": "assigned_variable", "loc": [311, 311], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L309_C0", "vector": [14, 1, 0.0754, 0.0002, 1, 0.92, 0.3333, 920, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "flat_code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " flat_code = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L312_C4", "label": "for c", "type": "for", "loc": [312, 313], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L309_C0", "vector": [6, 1, 0.0758, 0.0005, 1, 0.92, 0.6667, 411, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in code:\n flat_code.extend(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L313_C8", "label": "extend()", "type": "expression", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L312_C4", "vector": [8, 2, 0.0759, 0.0002, 2, 0.73, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " flat_code.extend(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L315_C4", "label": "return", "type": "return", "loc": [315, 315], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L309_C0", "vector": [13, 1, 0.0764, 0.0002, 1, 0.92, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return flat_code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L317_C0", "label": "make_character", "type": "function", "loc": [317, 323], "level": 0, "parent": null, "vector": [2, 0, 0.0776, 0.0017, 0, 0.66, 0.3161, 45, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "make_character", "arg_names": ["info", "value", "in_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def make_character(info, value, in_set=False):\n \"Makes a character literal.\"\n if in_set:\n # A character set is built case-sensitively.\n return Character(value)\n\n return Character(value, case_flags=info.flags & CASE_FLAGS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L318_C4", "label": "expression", "type": "expression", "loc": [318, 318], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L317_C0", "vector": [8, 1, 0.0771, 0.0002, 1, 0.52, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Makes a character literal.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L319_C4", "label": "if", "type": "if", "loc": [319, 321], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L317_C0", "vector": [4, 1, 0.0776, 0.0007, 1, 0.52, 0.5, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if in_set:\n # A character set is built case-sensitively.\n return Character(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L321_C8", "label": "return", "type": "return", "loc": [321, 321], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L319_C4", "vector": [13, 2, 0.0778, 0.0002, 2, 0.27, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Character(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L323_C4", "label": "return", "type": "return", "loc": [323, 323], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L317_C0", "vector": [13, 1, 0.0783, 0.0002, 1, 0.52, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Character(value, case_flags=info.flags & CASE_FLAGS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L325_C0", "label": "make_ref_group", "type": "function", "loc": [325, 327], "level": 0, "parent": null, "vector": [2, 0, 0.079, 0.0007, 0, 0.66, 0.3212, 536, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "make_ref_group", "arg_names": ["info", "name", "position"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def make_ref_group(info, name, position):\n \"Makes a group reference.\"\n return RefGroup(info, name, position, case_flags=info.flags & CASE_FLAGS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L326_C4", "label": "expression", "type": "expression", "loc": [326, 326], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L325_C0", "vector": [8, 1, 0.079, 0.0002, 1, 0.68, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Makes a group reference.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L327_C4", "label": "return", "type": "return", "loc": [327, 327], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L325_C0", "vector": [13, 1, 0.0793, 0.0002, 1, 0.68, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return RefGroup(info, name, position, case_flags=info.flags & CASE_FLAGS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L329_C0", "label": "make_string_set", "type": "function", "loc": [329, 331], "level": 0, "parent": null, "vector": [2, 0, 0.08, 0.0007, 0, 0.66, 0.3264, 892, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "make_string_set", "arg_names": ["info", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def make_string_set(info, name):\n \"Makes a string set.\"\n return StringSet(info, name, case_flags=info.flags & CASE_FLAGS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L330_C4", "label": "expression", "type": "expression", "loc": [330, 330], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L329_C0", "vector": [8, 1, 0.08, 0.0002, 1, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Makes a string set.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L331_C4", "label": "return", "type": "return", "loc": [331, 331], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L329_C0", "vector": [13, 1, 0.0802, 0.0002, 1, 0.19, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return StringSet(info, name, case_flags=info.flags & CASE_FLAGS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L333_C0", "label": "make_property", "type": "function", "loc": [333, 338], "level": 0, "parent": null, "vector": [2, 0, 0.0813, 0.0015, 0, 0.66, 0.3316, 707, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "make_property", "arg_names": ["info", "prop", "in_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def make_property(info, prop, in_set):\n \"Makes a property.\"\n if in_set:\n return prop\n\n return prop.with_flags(case_flags=info.flags & CASE_FLAGS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L334_C4", "label": "expression", "type": "expression", "loc": [334, 334], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L333_C0", "vector": [8, 1, 0.081, 0.0002, 1, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Makes a property.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L335_C4", "label": "if", "type": "if", "loc": [335, 336], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L333_C0", "vector": [4, 1, 0.0813, 0.0005, 1, 0.49, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if in_set:\n return prop"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L336_C8", "label": "return", "type": "return", "loc": [336, 336], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L335_C4", "vector": [13, 2, 0.0815, 0.0002, 2, 0.87, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return prop"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L338_C4", "label": "return", "type": "return", "loc": [338, 338], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L333_C0", "vector": [13, 1, 0.0819, 0.0002, 1, 0.49, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return prop.with_flags(case_flags=info.flags & CASE_FLAGS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L340_C0", "label": "_parse_pattern", "type": "function", "loc": [340, 348], "level": 0, "parent": null, "vector": [2, 0, 0.0834, 0.0022, 0, 0.66, 0.3368, 68, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "_parse_pattern", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _parse_pattern(source, info):\n \"Parses a pattern, eg. 'a|b|c'.\"\n branches = [parse_sequence(source, info)]\n while source.match(\"|\"):\n branches.append(parse_sequence(source, info))\n\n if len(branches) == 1:\n return branches[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L341_C4", "label": "expression", "type": "expression", "loc": [341, 341], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L340_C0", "vector": [8, 1, 0.0827, 0.0002, 1, 0.01, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a pattern, eg. 'a|b|c'.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L342_C4", "label": "branches =", "type": "assigned_variable", "loc": [342, 342], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L340_C0", "vector": [14, 1, 0.0829, 0.0002, 1, 0.01, 0.25, 286, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "branches", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " branches = [parse_sequence(source, info)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L343_C4", "label": "while", "type": "while", "loc": [343, 344], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L340_C0", "vector": [5, 1, 0.0833, 0.0005, 1, 0.01, 0.5, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while source.match(\"|\"):\n branches.append(parse_sequence(source, info))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L344_C8", "label": "append()", "type": "expression", "loc": [344, 344], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L343_C4", "vector": [8, 2, 0.0834, 0.0002, 2, 0.93, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " branches.append(parse_sequence(source, info))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L346_C4", "label": "if", "type": "if", "loc": [346, 347], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L340_C0", "vector": [4, 1, 0.084, 0.0005, 1, 0.01, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(branches) == 1:\n return branches[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L347_C8", "label": "return", "type": "return", "loc": [347, 347], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L346_C4", "vector": [13, 2, 0.0841, 0.0002, 2, 0.96, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return branches[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L348_C4", "label": "return", "type": "return", "loc": [348, 348], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L340_C0", "vector": [13, 1, 0.0844, 0.0002, 1, 0.01, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Branch(branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L350_C0", "label": "parse_sequence", "type": "function", "loc": [350, 395], "level": 0, "parent": null, "vector": [2, 0, 0.0903, 0.0112, 0, 0.66, 0.342, 172, 0, 2, 1, 0, 0, 0, 14], "semantic": {"name": "parse_sequence", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_sequence(source, info):\n \"Parses a sequence, eg. 'abc'.\"\n sequence = []\n applied = False\n while True:\n # Get literal characters followed by an element.\n characters, case_flags, element = parse_literal_and_element(source,\n info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L351_C4", "label": "expression", "type": "expression", "loc": [351, 351], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L350_C0", "vector": [8, 1, 0.0851, 0.0002, 1, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a sequence, eg. 'abc'.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L352_C4", "label": "sequence =", "type": "assigned_variable", "loc": [352, 352], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L350_C0", "vector": [14, 1, 0.0853, 0.0002, 1, 0.65, 0.25, 871, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "sequence", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sequence = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L353_C4", "label": "applied =", "type": "assigned_variable", "loc": [353, 353], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L350_C0", "vector": [14, 1, 0.0856, 0.0002, 1, 0.65, 0.5, 707, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "applied", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " applied = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L354_C4", "label": "while", "type": "while", "loc": [354, 393], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L350_C0", "vector": [5, 1, 0.0905, 0.0097, 1, 0.65, 0.75, 0, 1, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n # Get literal characters followed by an element.\n characters, case_flags, element = parse_literal_and_element(source,\n info)\n if not element:\n # No element, just a literal. We've also reached the end of the\n # sequence.\n append_literal(characters, case_flags, sequence)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L356_C8", "label": "characters, case_flags, element = parse_literal_and_element()", "type": "assigned_variable", "loc": [356, 357], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L354_C4", "vector": [14, 2, 0.0864, 0.0005, 2, 0.5, 0.0, 89, 3, 2, 0, 0, 179, 10, 1], "semantic": {"name": "characters, case_flags, element", "arg_names": [], "import_names": [], "rhs_call_name": "parse_literal_and_element", "annotation": ""}, "snippet": " characters, case_flags, element = parse_literal_and_element(source,\n info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L358_C8", "label": "if", "type": "if", "loc": [358, 362], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L354_C4", "vector": [4, 2, 0.0873, 0.0012, 2, 0.5, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not element:\n # No element, just a literal. We've also reached the end of the\n # sequence.\n append_literal(characters, case_flags, sequence)\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L361_C12", "label": "append_literal()", "type": "expression", "loc": [361, 361], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L358_C8", "vector": [8, 3, 0.0875, 0.0002, 3, 0.71, 0.0, 914, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "append_literal", "arg_names": [], "import_names": [], "rhs_call_name": "append_literal", "annotation": ""}, "snippet": " append_literal(characters, case_flags, sequence)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L364_C8", "label": "if", "type": "if", "loc": [364, 393], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L354_C4", "vector": [4, 2, 0.0918, 0.0073, 2, 0.5, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if element is COMMENT or element is FLAGS:\n append_literal(characters, case_flags, sequence)\n elif type(element) is tuple:\n # It looks like we've found a quantifier.\n ch, saved_pos = element\n\n counts = parse_quantifier(source, info, ch)\n if counts:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L365_C12", "label": "append_literal()", "type": "expression", "loc": [365, 365], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L364_C8", "vector": [8, 3, 0.0885, 0.0002, 3, 0.54, 0.0, 914, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "append_literal", "arg_names": [], "import_names": [], "rhs_call_name": "append_literal", "annotation": ""}, "snippet": " append_literal(characters, case_flags, sequence)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L366_C8", "label": "if", "type": "if", "loc": [366, 393], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L364_C8", "vector": [4, 3, 0.092, 0.0068, 3, 0.54, 1.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif type(element) is tuple:\n # It looks like we've found a quantifier.\n ch, saved_pos = element\n\n counts = parse_quantifier(source, info, ch)\n if counts:\n # It _is_ a quantifier.\n apply_quantifier(source, info, counts, characters, case_flags,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L368_C12", "label": "ch, saved_pos =", "type": "assigned_variable", "loc": [368, 368], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L366_C8", "vector": [14, 4, 0.0892, 0.0002, 4, 0.69, 0.0, 786, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ch, saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ch, saved_pos = element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L370_C12", "label": "counts = parse_quantifier()", "type": "assigned_variable", "loc": [370, 370], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L366_C8", "vector": [14, 4, 0.0897, 0.0002, 4, 0.69, 0.2, 560, 3, 3, 0, 0, 938, 10, 1], "semantic": {"name": "counts", "arg_names": [], "import_names": [], "rhs_call_name": "parse_quantifier", "annotation": ""}, "snippet": " counts = parse_quantifier(source, info, ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L371_C12", "label": "if", "type": "if", "loc": [371, 388], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L366_C8", "vector": [4, 4, 0.092, 0.0044, 4, 0.69, 0.4, 0, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if counts:\n # It _is_ a quantifier.\n apply_quantifier(source, info, counts, characters, case_flags,\n ch, saved_pos, applied, sequence)\n applied = True\n else:\n # It's not a quantifier. Maybe it's a fuzzy constraint.\n constraints = parse_fuzzy(source, ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L373_C16", "label": "apply_quantifier()", "type": "expression", "loc": [373, 374], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L371_C12", "vector": [8, 5, 0.0905, 0.0005, 5, 0.24, 0.0, 583, 3, 9, 0, 0, 0, 0, 1], "semantic": {"name": "apply_quantifier", "arg_names": [], "import_names": [], "rhs_call_name": "apply_quantifier", "annotation": ""}, "snippet": " apply_quantifier(source, info, counts, characters, case_flags,\n ch, saved_pos, applied, sequence)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L375_C16", "label": "applied =", "type": "assigned_variable", "loc": [375, 375], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L371_C12", "vector": [14, 5, 0.0909, 0.0002, 5, 0.24, 0.3333, 707, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "applied", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " applied = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L378_C16", "label": "constraints = parse_fuzzy()", "type": "assigned_variable", "loc": [378, 378], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L371_C12", "vector": [14, 5, 0.0916, 0.0002, 5, 0.24, 0.6667, 394, 3, 2, 0, 0, 504, 10, 1], "semantic": {"name": "constraints", "arg_names": [], "import_names": [], "rhs_call_name": "parse_fuzzy", "annotation": ""}, "snippet": " constraints = parse_fuzzy(source, ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L379_C16", "label": "if", "type": "if", "loc": [379, 388], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L371_C12", "vector": [4, 5, 0.093, 0.0024, 5, 0.24, 1.0, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if constraints:\n # It _is_ a fuzzy constraint.\n apply_constraint(source, info, constraints, characters,\n case_flags, saved_pos, applied, sequence)\n applied = True\n else:\n # The element was just a literal.\n characters.append(ord(ch))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L381_C20", "label": "apply_constraint()", "type": "expression", "loc": [381, 382], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L379_C16", "vector": [8, 6, 0.0925, 0.0005, 6, 0.94, 0.0, 985, 3, 8, 0, 0, 0, 0, 1], "semantic": {"name": "apply_constraint", "arg_names": [], "import_names": [], "rhs_call_name": "apply_constraint", "annotation": ""}, "snippet": " apply_constraint(source, info, constraints, characters,\n case_flags, saved_pos, applied, sequence)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L383_C20", "label": "applied =", "type": "assigned_variable", "loc": [383, 383], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L379_C16", "vector": [14, 6, 0.0928, 0.0002, 6, 0.94, 0.25, 707, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "applied", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " applied = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L386_C20", "label": "append()", "type": "expression", "loc": [386, 386], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L379_C16", "vector": [8, 6, 0.0936, 0.0002, 6, 0.94, 0.5, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " characters.append(ord(ch))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L387_C20", "label": "append_literal()", "type": "expression", "loc": [387, 387], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L379_C16", "vector": [8, 6, 0.0938, 0.0002, 6, 0.94, 0.75, 914, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "append_literal", "arg_names": [], "import_names": [], "rhs_call_name": "append_literal", "annotation": ""}, "snippet": " append_literal(characters, case_flags, sequence)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L388_C20", "label": "applied =", "type": "assigned_variable", "loc": [388, 388], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L379_C16", "vector": [14, 6, 0.0941, 0.0002, 6, 0.94, 1.0, 707, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "applied", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " applied = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L391_C12", "label": "append_literal()", "type": "expression", "loc": [391, 391], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L366_C8", "vector": [8, 4, 0.0948, 0.0002, 4, 0.69, 0.6, 914, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "append_literal", "arg_names": [], "import_names": [], "rhs_call_name": "append_literal", "annotation": ""}, "snippet": " append_literal(characters, case_flags, sequence)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L392_C12", "label": "append()", "type": "expression", "loc": [392, 392], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L366_C8", "vector": [8, 4, 0.095, 0.0002, 4, 0.69, 0.8, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " sequence.append(element)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L393_C12", "label": "applied =", "type": "assigned_variable", "loc": [393, 393], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L366_C8", "vector": [14, 4, 0.0953, 0.0002, 4, 0.69, 1.0, 707, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "applied", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " applied = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L395_C4", "label": "return", "type": "return", "loc": [395, 395], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L350_C0", "vector": [13, 1, 0.0958, 0.0002, 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 make_sequence(sequence)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L397_C0", "label": "apply_quantifier", "type": "function", "loc": [397, 429], "level": 0, "parent": null, "vector": [2, 0, 0.1001, 0.008, 0, 0.66, 0.3472, 583, 0, 9, 0, 0, 0, 0, 8], "semantic": {"name": "apply_quantifier", "arg_names": ["source", "info", "counts", "characters", "case_flags", "ch", "saved_pos", "applied", "sequence"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def apply_quantifier(source, info, counts, characters, case_flags, ch,\n saved_pos, applied, sequence):\n if characters:\n # The quantifier applies to the last character.\n append_literal(characters[ : -1], case_flags, sequence)\n element = Character(characters[-1], case_flags=case_flags)\n else:\n # The quantifier applies to the last item in the sequence."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L399_C4", "label": "if", "type": "if", "loc": [399, 408], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L397_C0", "vector": [4, 1, 0.0978, 0.0024, 1, 0.38, 0.0, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if characters:\n # The quantifier applies to the last character.\n append_literal(characters[ : -1], case_flags, sequence)\n element = Character(characters[-1], case_flags=case_flags)\n else:\n # The quantifier applies to the last item in the sequence.\n if applied or not sequence:\n raise error(\"nothing to repeat\", source.string, saved_pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L401_C8", "label": "append_literal()", "type": "expression", "loc": [401, 401], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L399_C4", "vector": [8, 2, 0.0972, 0.0002, 2, 0.87, 0.0, 914, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "append_literal", "arg_names": [], "import_names": [], "rhs_call_name": "append_literal", "annotation": ""}, "snippet": " append_literal(characters[ : -1], case_flags, sequence)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L402_C8", "label": "element = Character()", "type": "assigned_variable", "loc": [402, 402], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L399_C4", "vector": [14, 2, 0.0975, 0.0002, 2, 0.87, 0.3333, 736, 3, 2, 0, 0, 610, 10, 1], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "Character", "annotation": ""}, "snippet": " element = Character(characters[-1], case_flags=case_flags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L405_C8", "label": "if", "type": "if", "loc": [405, 406], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L399_C4", "vector": [4, 2, 0.0983, 0.0005, 2, 0.87, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if applied or not sequence:\n raise error(\"nothing to repeat\", source.string, saved_pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L408_C8", "label": "element = pop()", "type": "assigned_variable", "loc": [408, 408], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L399_C4", "vector": [14, 2, 0.0989, 0.0002, 2, 0.87, 1.0, 736, 3, 0, 0, 0, 969, 10, 1], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " element = sequence.pop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L410_C4", "label": "min_count, max_count =", "type": "assigned_variable", "loc": [410, 410], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L397_C0", "vector": [14, 1, 0.0994, 0.0002, 1, 0.38, 0.1667, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "min_count, max_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " min_count, max_count = counts"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L411_C4", "label": "saved_pos =", "type": "assigned_variable", "loc": [411, 411], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L397_C0", "vector": [14, 1, 0.0996, 0.0002, 1, 0.38, 0.3333, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L412_C4", "label": "ch = get()", "type": "assigned_variable", "loc": [412, 412], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L397_C0", "vector": [14, 1, 0.0999, 0.0002, 1, 0.38, 0.5, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L413_C4", "label": "if", "type": "if", "loc": [413, 422], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L397_C0", "vector": [4, 1, 0.1012, 0.0024, 1, 0.38, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"?\":\n # The \"?\" suffix that means it's a lazy repeat.\n repeated = LazyRepeat\n elif ch == \"+\":\n # The \"+\" suffix that means it's a possessive repeat.\n repeated = PossessiveRepeat\n else:\n # No suffix means that it's a greedy repeat."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L415_C8", "label": "repeated =", "type": "assigned_variable", "loc": [415, 415], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L413_C4", "vector": [14, 2, 0.1006, 0.0002, 2, 0.3, 0.0, 392, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "repeated", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " repeated = LazyRepeat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L416_C4", "label": "if", "type": "if", "loc": [416, 422], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L413_C4", "vector": [4, 2, 0.1016, 0.0017, 2, 0.3, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ch == \"+\":\n # The \"+\" suffix that means it's a possessive repeat.\n repeated = PossessiveRepeat\n else:\n # No suffix means that it's a greedy repeat.\n source.pos = saved_pos\n repeated = GreedyRepeat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L418_C8", "label": "repeated =", "type": "assigned_variable", "loc": [418, 418], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L416_C4", "vector": [14, 3, 0.1013, 0.0002, 3, 0.7, 0.0, 392, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "repeated", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " repeated = PossessiveRepeat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L421_C8", "label": "source.pos =", "type": "assigned_variable", "loc": [421, 421], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L416_C4", "vector": [14, 3, 0.1021, 0.0002, 3, 0.7, 0.5, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L422_C8", "label": "repeated =", "type": "assigned_variable", "loc": [422, 422], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L416_C4", "vector": [14, 3, 0.1023, 0.0002, 3, 0.7, 1.0, 392, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "repeated", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " repeated = GreedyRepeat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L426_C4", "label": "if", "type": "if", "loc": [426, 427], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L397_C0", "vector": [4, 1, 0.1034, 0.0005, 1, 0.38, 0.8333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not element.is_empty() and (min_count != 1 or max_count != 1):\n element = repeated(element, min_count, max_count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L427_C8", "label": "element = repeated()", "type": "assigned_variable", "loc": [427, 427], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L426_C4", "vector": [14, 2, 0.1035, 0.0002, 2, 0.74, 0.0, 736, 3, 3, 0, 0, 392, 10, 1], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "repeated", "annotation": ""}, "snippet": " element = repeated(element, min_count, max_count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L429_C4", "label": "append()", "type": "expression", "loc": [429, 429], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L397_C0", "vector": [8, 1, 0.104, 0.0002, 1, 0.38, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " sequence.append(element)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L431_C0", "label": "apply_constraint", "type": "function", "loc": [431, 452], "level": 0, "parent": null, "vector": [2, 0, 0.107, 0.0053, 0, 0.66, 0.3523, 985, 0, 8, 0, 0, 0, 0, 11], "semantic": {"name": "apply_constraint", "arg_names": ["source", "info", "constraints", "characters", "case_flags", "saved_pos", "applied", "sequence"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def apply_constraint(source, info, constraints, characters, case_flags,\n saved_pos, applied, sequence):\n if characters:\n # The constraint applies to the last character.\n append_literal(characters[ : -1], case_flags, sequence)\n element = Character(characters[-1], case_flags=case_flags)\n sequence.append(Fuzzy(element, constraints))\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L433_C4", "label": "if", "type": "if", "loc": [433, 452], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L431_C0", "vector": [4, 1, 0.1073, 0.0048, 1, 0.09, 0.0, 0, 2, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if characters:\n # The constraint applies to the last character.\n append_literal(characters[ : -1], case_flags, sequence)\n element = Character(characters[-1], case_flags=case_flags)\n sequence.append(Fuzzy(element, constraints))\n else:\n # The constraint applies to the last item in the sequence.\n if applied or not sequence:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L435_C8", "label": "append_literal()", "type": "expression", "loc": [435, 435], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L433_C4", "vector": [8, 2, 0.1055, 0.0002, 2, 0.11, 0.0, 914, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "append_literal", "arg_names": [], "import_names": [], "rhs_call_name": "append_literal", "annotation": ""}, "snippet": " append_literal(characters[ : -1], case_flags, sequence)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L436_C8", "label": "element = Character()", "type": "assigned_variable", "loc": [436, 436], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L433_C4", "vector": [14, 2, 0.1057, 0.0002, 2, 0.11, 0.2, 736, 3, 2, 0, 0, 610, 10, 1], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "Character", "annotation": ""}, "snippet": " element = Character(characters[-1], case_flags=case_flags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L437_C8", "label": "append()", "type": "expression", "loc": [437, 437], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L433_C4", "vector": [8, 2, 0.1059, 0.0002, 2, 0.11, 0.4, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " sequence.append(Fuzzy(element, constraints))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L440_C8", "label": "if", "type": "if", "loc": [440, 442], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L433_C4", "vector": [4, 2, 0.1069, 0.0007, 2, 0.11, 0.6, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if applied or not sequence:\n raise error(\"nothing for fuzzy constraint\", source.string,\n saved_pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L444_C8", "label": "element = pop()", "type": "assigned_variable", "loc": [444, 444], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L433_C4", "vector": [14, 2, 0.1076, 0.0002, 2, 0.11, 0.8, 736, 3, 0, 0, 0, 969, 10, 1], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " element = sequence.pop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L448_C8", "label": "if", "type": "if", "loc": [448, 452], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L433_C4", "vector": [4, 2, 0.1091, 0.0012, 2, 0.11, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(element, Group):\n element.subpattern = Fuzzy(element.subpattern, constraints)\n sequence.append(element)\n else:\n sequence.append(Fuzzy(element, constraints))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L449_C12", "label": "element.subpattern = Fuzzy()", "type": "assigned_variable", "loc": [449, 449], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L448_C8", "vector": [14, 3, 0.1088, 0.0002, 3, 0.54, 0.0, 281, 3, 2, 0, 0, 319, 10, 1], "semantic": {"name": "element.subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "Fuzzy", "annotation": ""}, "snippet": " element.subpattern = Fuzzy(element.subpattern, constraints)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L450_C12", "label": "append()", "type": "expression", "loc": [450, 450], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L448_C8", "vector": [8, 3, 0.1091, 0.0002, 3, 0.54, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " sequence.append(element)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L452_C12", "label": "append()", "type": "expression", "loc": [452, 452], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L448_C8", "vector": [8, 3, 0.1096, 0.0002, 3, 0.54, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " sequence.append(Fuzzy(element, constraints))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L454_C0", "label": "append_literal", "type": "function", "loc": [454, 456], "level": 0, "parent": null, "vector": [2, 0, 0.1103, 0.0007, 0, 0.66, 0.3575, 914, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "append_literal", "arg_names": ["characters", "case_flags", "sequence"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def append_literal(characters, case_flags, sequence):\n if characters:\n sequence.append(Literal(characters, case_flags=case_flags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L455_C4", "label": "if", "type": "if", "loc": [455, 456], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L454_C0", "vector": [4, 1, 0.1104, 0.0005, 1, 0.92, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if characters:\n sequence.append(Literal(characters, case_flags=case_flags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L456_C8", "label": "append()", "type": "expression", "loc": [456, 456], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L455_C4", "vector": [8, 2, 0.1105, 0.0002, 2, 0.75, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " sequence.append(Literal(characters, case_flags=case_flags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L458_C0", "label": "PossessiveRepeat", "type": "function", "loc": [458, 460], "level": 0, "parent": null, "vector": [2, 0, 0.1113, 0.0007, 0, 0.66, 0.3627, 182, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "PossessiveRepeat", "arg_names": ["element", "min_count", "max_count"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def PossessiveRepeat(element, min_count, max_count):\n \"Builds a possessive repeat.\"\n return Atomic(GreedyRepeat(element, min_count, max_count))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L459_C4", "label": "expression", "type": "expression", "loc": [459, 459], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L458_C0", "vector": [8, 1, 0.1113, 0.0002, 1, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Builds a possessive repeat.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L460_C4", "label": "return", "type": "return", "loc": [460, 460], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L458_C0", "vector": [13, 1, 0.1115, 0.0002, 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 Atomic(GreedyRepeat(element, min_count, max_count))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L462_C0", "label": "_QUANTIFIERS =", "type": "assigned_variable", "loc": [462, 462], "level": 0, "parent": null, "vector": [14, 0, 0.112, 0.0002, 0, 0.66, 0.3679, 310, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_QUANTIFIERS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_QUANTIFIERS = {\"?\": (0, 1), \"*\": (0, None), \"+\": (1, None)}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L464_C0", "label": "parse_quantifier", "type": "function", "loc": [464, 477], "level": 0, "parent": null, "vector": [2, 0, 0.1141, 0.0034, 0, 0.66, 0.3731, 938, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "parse_quantifier", "arg_names": ["source", "info", "ch"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_quantifier(source, info, ch):\n \"Parses a quantifier.\"\n q = _QUANTIFIERS.get(ch)\n if q:\n # It's a quantifier.\n return q\n\n if ch == \"{\":"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L465_C4", "label": "expression", "type": "expression", "loc": [465, 465], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L464_C0", "vector": [8, 1, 0.1127, 0.0002, 1, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a quantifier.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L466_C4", "label": "q = get()", "type": "assigned_variable", "loc": [466, 466], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L464_C0", "vector": [14, 1, 0.113, 0.0002, 1, 0.67, 0.25, 516, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " q = _QUANTIFIERS.get(ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L467_C4", "label": "if", "type": "if", "loc": [467, 469], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L464_C0", "vector": [4, 1, 0.1135, 0.0007, 1, 0.67, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if q:\n # It's a quantifier.\n return q"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L469_C8", "label": "return", "type": "return", "loc": [469, 469], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L467_C4", "vector": [13, 2, 0.1137, 0.0002, 2, 0.65, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return q"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L471_C4", "label": "if", "type": "if", "loc": [471, 475], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L464_C0", "vector": [4, 1, 0.1147, 0.0012, 1, 0.67, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"{\":\n # Looks like a limited repeated element, eg. 'a{2,3}'.\n counts = parse_limited_quantifier(source)\n if counts:\n return counts"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L473_C8", "label": "counts = parse_limited_quantifier()", "type": "assigned_variable", "loc": [473, 473], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L471_C4", "vector": [14, 2, 0.1147, 0.0002, 2, 0.22, 0.0, 560, 3, 1, 0, 0, 855, 10, 1], "semantic": {"name": "counts", "arg_names": [], "import_names": [], "rhs_call_name": "parse_limited_quantifier", "annotation": ""}, "snippet": " counts = parse_limited_quantifier(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L474_C8", "label": "if", "type": "if", "loc": [474, 475], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L471_C4", "vector": [4, 2, 0.115, 0.0005, 2, 0.22, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if counts:\n return counts"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L475_C12", "label": "return", "type": "return", "loc": [475, 475], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L474_C8", "vector": [13, 3, 0.1152, 0.0002, 3, 0.52, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return counts"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L477_C4", "label": "return", "type": "return", "loc": [477, 477], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L464_C0", "vector": [13, 1, 0.1156, 0.0002, 1, 0.67, 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_1389:FunctionDef_L479_C0", "label": "is_above_limit", "type": "function", "loc": [479, 481], "level": 0, "parent": null, "vector": [2, 0, 0.1164, 0.0007, 0, 0.66, 0.3782, 943, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "is_above_limit", "arg_names": ["count"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_above_limit(count):\n \"Checks whether a count is above the maximum.\"\n return count is not None and count >= UNLIMITED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L480_C4", "label": "expression", "type": "expression", "loc": [480, 480], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L479_C0", "vector": [8, 1, 0.1164, 0.0002, 1, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Checks whether a count is above the maximum.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L481_C4", "label": "return", "type": "return", "loc": [481, 481], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L479_C0", "vector": [13, 1, 0.1166, 0.0002, 1, 0.54, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return count is not None and count >= UNLIMITED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L483_C0", "label": "parse_limited_quantifier", "type": "function", "loc": [483, 511], "level": 0, "parent": null, "vector": [2, 0, 0.1205, 0.007, 0, 0.66, 0.3834, 855, 0, 1, 1, 0, 0, 0, 11], "semantic": {"name": "parse_limited_quantifier", "arg_names": ["source"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_limited_quantifier(source):\n \"Parses a limited quantifier.\"\n saved_pos = source.pos\n min_count = parse_count(source)\n if source.match(\",\"):\n max_count = parse_count(source)\n\n # No minimum means 0 and no maximum means unlimited."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L484_C4", "label": "expression", "type": "expression", "loc": [484, 484], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L483_C0", "vector": [8, 1, 0.1173, 0.0002, 1, 0.11, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a limited quantifier.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L485_C4", "label": "saved_pos =", "type": "assigned_variable", "loc": [485, 485], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L483_C0", "vector": [14, 1, 0.1176, 0.0002, 1, 0.11, 0.1667, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L486_C4", "label": "min_count = parse_count()", "type": "assigned_variable", "loc": [486, 486], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L483_C0", "vector": [14, 1, 0.1178, 0.0002, 1, 0.11, 0.3333, 412, 3, 1, 0, 0, 384, 10, 1], "semantic": {"name": "min_count", "arg_names": [], "import_names": [], "rhs_call_name": "parse_count", "annotation": ""}, "snippet": " min_count = parse_count(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L487_C4", "label": "if", "type": "if", "loc": [487, 502], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L483_C0", "vector": [4, 1, 0.1199, 0.0039, 1, 0.11, 0.5, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source.match(\",\"):\n max_count = parse_count(source)\n\n # No minimum means 0 and no maximum means unlimited.\n min_count = int(min_count or 0)\n max_count = int(max_count) if max_count else None\n\n if max_count is not None and min_count > max_count:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L488_C8", "label": "max_count = parse_count()", "type": "assigned_variable", "loc": [488, 488], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L487_C4", "vector": [14, 2, 0.1183, 0.0002, 2, 0.86, 0.0, 632, 3, 1, 0, 0, 384, 10, 1], "semantic": {"name": "max_count", "arg_names": [], "import_names": [], "rhs_call_name": "parse_count", "annotation": ""}, "snippet": " max_count = parse_count(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L491_C8", "label": "min_count = int()", "type": "assigned_variable", "loc": [491, 491], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L487_C4", "vector": [14, 2, 0.119, 0.0002, 2, 0.86, 0.2, 412, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "min_count", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " min_count = int(min_count or 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L492_C8", "label": "max_count =", "type": "assigned_variable", "loc": [492, 492], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L487_C4", "vector": [14, 2, 0.1193, 0.0002, 2, 0.86, 0.4, 632, 8, 0, 0, 0, 0, 0, 1], "semantic": {"name": "max_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_count = int(max_count) if max_count else None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L494_C8", "label": "if", "type": "if", "loc": [494, 496], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L487_C4", "vector": [4, 2, 0.12, 0.0007, 2, 0.86, 0.6, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if max_count is not None and min_count > max_count:\n raise error(\"min repeat greater than max repeat\", source.string,\n saved_pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L498_C8", "label": "if", "type": "if", "loc": [498, 500], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L487_C4", "vector": [4, 2, 0.121, 0.0007, 2, 0.86, 0.8, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not min_count:\n source.pos = saved_pos\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L499_C12", "label": "source.pos =", "type": "assigned_variable", "loc": [499, 499], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L498_C8", "vector": [14, 3, 0.121, 0.0002, 3, 0.77, 0.0, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L500_C12", "label": "return", "type": "return", "loc": [500, 500], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L498_C8", "vector": [13, 3, 0.1212, 0.0002, 3, 0.77, 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_1389:Assign_L502_C8", "label": "min_count = int()", "type": "assigned_variable", "loc": [502, 502], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L487_C4", "vector": [14, 2, 0.1217, 0.0002, 2, 0.86, 1.0, 412, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "min_count", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " min_count = max_count = int(min_count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L504_C4", "label": "if", "type": "if", "loc": [504, 505], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L483_C0", "vector": [4, 1, 0.1223, 0.0005, 1, 0.11, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if is_above_limit(min_count) or is_above_limit(max_count):\n raise error(\"repeat count too big\", source.string, saved_pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L507_C4", "label": "if", "type": "if", "loc": [507, 509], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L483_C0", "vector": [4, 1, 0.1232, 0.0007, 1, 0.11, 0.8333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not source.match (\"}\"):\n source.pos = saved_pos\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L508_C8", "label": "source.pos =", "type": "assigned_variable", "loc": [508, 508], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L507_C4", "vector": [14, 2, 0.1232, 0.0002, 2, 0.92, 0.0, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L509_C8", "label": "return", "type": "return", "loc": [509, 509], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L507_C4", "vector": [13, 2, 0.1234, 0.0002, 2, 0.92, 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_1389:Return_L511_C4", "label": "return", "type": "return", "loc": [511, 511], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L483_C0", "vector": [13, 1, 0.1239, 0.0002, 1, 0.11, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return min_count, max_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L513_C0", "label": "parse_fuzzy", "type": "function", "loc": [513, 532], "level": 0, "parent": null, "vector": [2, 0, 0.1267, 0.0048, 0, 0.66, 0.3886, 504, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "parse_fuzzy", "arg_names": ["source", "ch"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_fuzzy(source, ch):\n \"Parses a fuzzy setting, if present.\"\n if ch != \"{\":\n return None\n\n saved_pos = source.pos\n\n constraints = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L514_C4", "label": "expression", "type": "expression", "loc": [514, 514], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L513_C0", "vector": [8, 1, 0.1246, 0.0002, 1, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a fuzzy setting, if present.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L515_C4", "label": "if", "type": "if", "loc": [515, 516], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L513_C0", "vector": [4, 1, 0.125, 0.0005, 1, 0.16, 0.1667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch != \"{\":\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L516_C8", "label": "return", "type": "return", "loc": [516, 516], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L515_C4", "vector": [13, 2, 0.1251, 0.0002, 2, 0.02, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L518_C4", "label": "saved_pos =", "type": "assigned_variable", "loc": [518, 518], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L513_C0", "vector": [14, 1, 0.1256, 0.0002, 1, 0.16, 0.3333, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L520_C4", "label": "constraints =", "type": "assigned_variable", "loc": [520, 520], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L513_C0", "vector": [14, 1, 0.1261, 0.0002, 1, 0.16, 0.5, 394, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "constraints", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " constraints = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L521_C4", "label": "try", "type": "try", "loc": [521, 527], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L513_C0", "vector": [7, 1, 0.127, 0.0017, 1, 0.16, 0.6667, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n parse_fuzzy_item(source, constraints)\n while source.match(\",\"):\n parse_fuzzy_item(source, constraints)\n except ParseError:\n source.pos = saved_pos\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L522_C8", "label": "parse_fuzzy_item()", "type": "expression", "loc": [522, 522], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L521_C4", "vector": [8, 2, 0.1265, 0.0002, 2, 0.16, 0.0, 784, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "parse_fuzzy_item", "arg_names": [], "import_names": [], "rhs_call_name": "parse_fuzzy_item", "annotation": ""}, "snippet": " parse_fuzzy_item(source, constraints)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L523_C8", "label": "while", "type": "while", "loc": [523, 524], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L521_C4", "vector": [5, 2, 0.1269, 0.0005, 2, 0.16, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while source.match(\",\"):\n parse_fuzzy_item(source, constraints)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L524_C12", "label": "parse_fuzzy_item()", "type": "expression", "loc": [524, 524], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L523_C8", "vector": [8, 3, 0.127, 0.0002, 3, 0.01, 0.0, 784, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "parse_fuzzy_item", "arg_names": [], "import_names": [], "rhs_call_name": "parse_fuzzy_item", "annotation": ""}, "snippet": " parse_fuzzy_item(source, constraints)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L526_C8", "label": "source.pos =", "type": "assigned_variable", "loc": [526, 526], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L521_C4", "vector": [14, 2, 0.1275, 0.0002, 2, 0.16, 0.0, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L527_C8", "label": "return", "type": "return", "loc": [527, 527], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L521_C4", "vector": [13, 2, 0.1278, 0.0002, 2, 0.16, 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_1389:If_L529_C4", "label": "if", "type": "if", "loc": [529, 530], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L513_C0", "vector": [4, 1, 0.1284, 0.0005, 1, 0.16, 0.8333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not source.match(\"}\"):\n raise error(\"expected }\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L532_C4", "label": "return", "type": "return", "loc": [532, 532], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L513_C0", "vector": [13, 1, 0.129, 0.0002, 1, 0.16, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return constraints"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L534_C0", "label": "parse_fuzzy_item", "type": "function", "loc": [534, 542], "level": 0, "parent": null, "vector": [2, 0, 0.1304, 0.0022, 0, 0.66, 0.3938, 784, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "parse_fuzzy_item", "arg_names": ["source", "constraints"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_fuzzy_item(source, constraints):\n \"Parses a fuzzy setting item.\"\n saved_pos = source.pos\n try:\n parse_cost_constraint(source, constraints)\n except ParseError:\n source.pos = saved_pos\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L535_C4", "label": "expression", "type": "expression", "loc": [535, 535], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L534_C0", "vector": [8, 1, 0.1297, 0.0002, 1, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a fuzzy setting item.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L536_C4", "label": "saved_pos =", "type": "assigned_variable", "loc": [536, 536], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L534_C0", "vector": [14, 1, 0.1299, 0.0002, 1, 0.85, 0.5, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L537_C4", "label": "try", "type": "try", "loc": [537, 542], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L534_C0", "vector": [7, 1, 0.1308, 0.0015, 1, 0.85, 1.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n parse_cost_constraint(source, constraints)\n except ParseError:\n source.pos = saved_pos\n\n parse_cost_equation(source, constraints)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L538_C8", "label": "parse_cost_constraint()", "type": "expression", "loc": [538, 538], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L537_C4", "vector": [8, 2, 0.1304, 0.0002, 2, 0.91, 0.0, 460, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "parse_cost_constraint", "arg_names": [], "import_names": [], "rhs_call_name": "parse_cost_constraint", "annotation": ""}, "snippet": " parse_cost_constraint(source, constraints)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L540_C8", "label": "source.pos =", "type": "assigned_variable", "loc": [540, 540], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L537_C4", "vector": [14, 2, 0.1309, 0.0002, 2, 0.91, 0.0, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L542_C8", "label": "parse_cost_equation()", "type": "expression", "loc": [542, 542], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L537_C4", "vector": [8, 2, 0.1314, 0.0002, 2, 0.91, 1.0, 857, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "parse_cost_equation", "arg_names": [], "import_names": [], "rhs_call_name": "parse_cost_equation", "annotation": ""}, "snippet": " parse_cost_equation(source, constraints)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L544_C0", "label": "parse_cost_constraint", "type": "function", "loc": [544, 604], "level": 0, "parent": null, "vector": [2, 0, 0.1392, 0.0148, 0, 0.66, 0.399, 460, 0, 2, 0, 0, 0, 0, 19], "semantic": {"name": "parse_cost_constraint", "arg_names": ["source", "constraints"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_cost_constraint(source, constraints):\n \"Parses a cost constraint.\"\n saved_pos = source.pos\n ch = source.get()\n if ch in ALPHA:\n # Syntax: constraint [(\"<=\" | \"<\") cost]\n constraint = parse_constraint(source, constraints, ch)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L545_C4", "label": "expression", "type": "expression", "loc": [545, 545], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L544_C0", "vector": [8, 1, 0.1321, 0.0002, 1, 0.78, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a cost constraint.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L546_C4", "label": "saved_pos =", "type": "assigned_variable", "loc": [546, 546], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L544_C0", "vector": [14, 1, 0.1324, 0.0002, 1, 0.78, 0.3333, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L547_C4", "label": "ch = get()", "type": "assigned_variable", "loc": [547, 547], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L544_C0", "vector": [14, 1, 0.1326, 0.0002, 1, 0.78, 0.6667, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L548_C4", "label": "if", "type": "if", "loc": [548, 604], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L544_C0", "vector": [4, 1, 0.1396, 0.0138, 1, 0.78, 1.0, 0, 0, 0, 0, 0, 0, 0, 18], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch in ALPHA:\n # Syntax: constraint [(\"<=\" | \"<\") cost]\n constraint = parse_constraint(source, constraints, ch)\n\n max_inc = parse_fuzzy_compare(source)\n\n if max_inc is None:\n # No maximum cost."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L550_C8", "label": "constraint = parse_constraint()", "type": "assigned_variable", "loc": [550, 550], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L548_C4", "vector": [14, 2, 0.1333, 0.0002, 2, 0.05, 0.0, 129, 3, 3, 0, 0, 169, 10, 1], "semantic": {"name": "constraint", "arg_names": [], "import_names": [], "rhs_call_name": "parse_constraint", "annotation": ""}, "snippet": " constraint = parse_constraint(source, constraints, ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L552_C8", "label": "max_inc = parse_fuzzy_compare()", "type": "assigned_variable", "loc": [552, 552], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L548_C4", "vector": [14, 2, 0.1338, 0.0002, 2, 0.05, 0.3333, 88, 3, 1, 0, 0, 965, 10, 1], "semantic": {"name": "max_inc", "arg_names": [], "import_names": [], "rhs_call_name": "parse_fuzzy_compare", "annotation": ""}, "snippet": " max_inc = parse_fuzzy_compare(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L554_C8", "label": "if", "type": "if", "loc": [554, 569], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L548_C4", "vector": [4, 2, 0.1361, 0.0039, 2, 0.05, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if max_inc is None:\n # No maximum cost.\n constraints[constraint] = 0, None\n else:\n # There's a maximum cost.\n cost_pos = source.pos\n max_cost = int(parse_count(source))\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L556_C12", "label": "assign", "type": "assigned_variable", "loc": [556, 556], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L554_C8", "vector": [14, 3, 0.1348, 0.0002, 3, 0.79, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " constraints[constraint] = 0, None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L559_C12", "label": "cost_pos =", "type": "assigned_variable", "loc": [559, 559], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L554_C8", "vector": [14, 3, 0.1355, 0.0002, 3, 0.79, 0.2, 177, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cost_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cost_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L560_C12", "label": "max_cost = int()", "type": "assigned_variable", "loc": [560, 560], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L554_C8", "vector": [14, 3, 0.1358, 0.0002, 3, 0.79, 0.4, 467, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "max_cost", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " max_cost = int(parse_count(source))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L563_C12", "label": "if", "type": "if", "loc": [563, 564], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L554_C8", "vector": [4, 3, 0.1366, 0.0005, 3, 0.79, 0.6, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not max_inc:\n max_cost -= 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L566_C12", "label": "if", "type": "if", "loc": [566, 567], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L554_C8", "vector": [4, 3, 0.1373, 0.0005, 3, 0.79, 0.8, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if max_cost < 0:\n raise error(\"bad fuzzy cost limit\", source.string, cost_pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L569_C12", "label": "assign", "type": "assigned_variable", "loc": [569, 569], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L554_C8", "vector": [14, 3, 0.1379, 0.0002, 3, 0.79, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " constraints[constraint] = 0, max_cost"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L570_C4", "label": "if", "type": "if", "loc": [570, 604], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L548_C4", "vector": [4, 2, 0.1423, 0.0085, 2, 0.05, 1.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ch in DIGITS:\n # Syntax: cost (\"<=\" | \"<\") constraint (\"<=\" | \"<\") cost\n source.pos = saved_pos\n try:\n # Minimum cost.\n min_cost = int(parse_count(source))\n\n min_inc = parse_fuzzy_compare(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L572_C8", "label": "source.pos =", "type": "assigned_variable", "loc": [572, 572], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L570_C4", "vector": [14, 3, 0.1387, 0.0002, 3, 0.19, 0.0, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "label": "try", "type": "try", "loc": [573, 602], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L570_C4", "vector": [7, 3, 0.1424, 0.0073, 3, 0.19, 1.0, 0, 0, 1, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # Minimum cost.\n min_cost = int(parse_count(source))\n\n min_inc = parse_fuzzy_compare(source)\n if min_inc is None:\n raise ParseError()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L575_C12", "label": "min_cost = int()", "type": "assigned_variable", "loc": [575, 575], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "vector": [14, 4, 0.1394, 0.0002, 4, 0.23, 0.0, 464, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "min_cost", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " min_cost = int(parse_count(source))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L577_C12", "label": "min_inc = parse_fuzzy_compare()", "type": "assigned_variable", "loc": [577, 577], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "vector": [14, 4, 0.1399, 0.0002, 4, 0.23, 0.0909, 514, 3, 1, 0, 0, 965, 10, 1], "semantic": {"name": "min_inc", "arg_names": [], "import_names": [], "rhs_call_name": "parse_fuzzy_compare", "annotation": ""}, "snippet": " min_inc = parse_fuzzy_compare(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L578_C12", "label": "if", "type": "if", "loc": [578, 579], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "vector": [4, 4, 0.1402, 0.0005, 4, 0.23, 0.1818, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if min_inc is None:\n raise ParseError()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L581_C12", "label": "constraint = parse_constraint()", "type": "assigned_variable", "loc": [581, 581], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "vector": [14, 4, 0.1408, 0.0002, 4, 0.23, 0.2727, 129, 3, 3, 0, 0, 169, 10, 2], "semantic": {"name": "constraint", "arg_names": [], "import_names": [], "rhs_call_name": "parse_constraint", "annotation": ""}, "snippet": " constraint = parse_constraint(source, constraints, source.get())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L583_C12", "label": "max_inc = parse_fuzzy_compare()", "type": "assigned_variable", "loc": [583, 583], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "vector": [14, 4, 0.1413, 0.0002, 4, 0.23, 0.3636, 88, 3, 1, 0, 0, 965, 10, 1], "semantic": {"name": "max_inc", "arg_names": [], "import_names": [], "rhs_call_name": "parse_fuzzy_compare", "annotation": ""}, "snippet": " max_inc = parse_fuzzy_compare(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L584_C12", "label": "if", "type": "if", "loc": [584, 585], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "vector": [4, 4, 0.1417, 0.0005, 4, 0.23, 0.4545, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if max_inc is None:\n raise ParseError()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L588_C12", "label": "cost_pos =", "type": "assigned_variable", "loc": [588, 588], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "vector": [14, 4, 0.1425, 0.0002, 4, 0.23, 0.5455, 177, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cost_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cost_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L589_C12", "label": "max_cost = int()", "type": "assigned_variable", "loc": [589, 589], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "vector": [14, 4, 0.1428, 0.0002, 4, 0.23, 0.6364, 467, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "max_cost", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " max_cost = int(parse_count(source))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L592_C12", "label": "if", "type": "if", "loc": [592, 593], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "vector": [4, 4, 0.1436, 0.0005, 4, 0.23, 0.7273, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not min_inc:\n min_cost += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L594_C12", "label": "if", "type": "if", "loc": [594, 595], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "vector": [4, 4, 0.1441, 0.0005, 4, 0.23, 0.8182, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not max_inc:\n max_cost -= 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L597_C12", "label": "if", "type": "if", "loc": [597, 598], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "vector": [4, 4, 0.1448, 0.0005, 4, 0.23, 0.9091, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not 0 <= min_cost <= max_cost:\n raise error(\"bad fuzzy cost limit\", source.string, cost_pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L600_C12", "label": "assign", "type": "assigned_variable", "loc": [600, 600], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "vector": [14, 4, 0.1455, 0.0002, 4, 0.23, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " constraints[constraint] = min_cost, max_cost"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L606_C0", "label": "parse_constraint", "type": "function", "loc": [606, 614], "level": 0, "parent": null, "vector": [2, 0, 0.1479, 0.0022, 0, 0.66, 0.4041, 169, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "parse_constraint", "arg_names": ["source", "constraints", "ch"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_constraint(source, constraints, ch):\n \"Parses a constraint.\"\n if ch not in \"deis\":\n raise error(\"bad fuzzy constraint\", source.string, source.pos)\n\n if ch in constraints:\n raise error(\"repeated fuzzy constraint\", source.string, source.pos)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L607_C4", "label": "expression", "type": "expression", "loc": [607, 607], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L606_C0", "vector": [8, 1, 0.1472, 0.0002, 1, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a constraint.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L608_C4", "label": "if", "type": "if", "loc": [608, 609], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L606_C0", "vector": [4, 1, 0.1475, 0.0005, 1, 0.93, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch not in \"deis\":\n raise error(\"bad fuzzy constraint\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L611_C4", "label": "if", "type": "if", "loc": [611, 612], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L606_C0", "vector": [4, 1, 0.1482, 0.0005, 1, 0.93, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch in constraints:\n raise error(\"repeated fuzzy constraint\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L614_C4", "label": "return", "type": "return", "loc": [614, 614], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L606_C0", "vector": [13, 1, 0.1488, 0.0002, 1, 0.93, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ch"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L616_C0", "label": "parse_fuzzy_compare", "type": "function", "loc": [616, 623], "level": 0, "parent": null, "vector": [2, 0, 0.1502, 0.0019, 0, 0.66, 0.4093, 965, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "parse_fuzzy_compare", "arg_names": ["source"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_fuzzy_compare(source):\n \"Parses a cost comparator.\"\n if source.match(\"<=\"):\n return True\n elif source.match(\"<\"):\n return False\n else:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L617_C4", "label": "expression", "type": "expression", "loc": [617, 617], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L616_C0", "vector": [8, 1, 0.1496, 0.0002, 1, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a cost comparator.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L618_C4", "label": "if", "type": "if", "loc": [618, 623], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L616_C0", "vector": [4, 1, 0.1504, 0.0015, 1, 0.65, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source.match(\"<=\"):\n return True\n elif source.match(\"<\"):\n return False\n else:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L619_C8", "label": "return", "type": "return", "loc": [619, 619], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L618_C4", "vector": [13, 2, 0.1501, 0.0002, 2, 0.65, 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_1389:If_L620_C4", "label": "if", "type": "if", "loc": [620, 623], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L618_C4", "vector": [4, 2, 0.1507, 0.001, 2, 0.65, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif source.match(\"<\"):\n return False\n else:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L621_C8", "label": "return", "type": "return", "loc": [621, 621], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L620_C4", "vector": [13, 3, 0.1505, 0.0002, 3, 0.87, 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_1389:Return_L623_C8", "label": "return", "type": "return", "loc": [623, 623], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L620_C4", "vector": [13, 3, 0.151, 0.0002, 3, 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_1389:FunctionDef_L625_C0", "label": "parse_cost_equation", "type": "function", "loc": [625, 650], "level": 0, "parent": null, "vector": [2, 0, 0.1545, 0.0063, 0, 0.66, 0.4145, 857, 0, 2, 0, 0, 0, 0, 9], "semantic": {"name": "parse_cost_equation", "arg_names": ["source", "constraints"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_cost_equation(source, constraints):\n \"Parses a cost equation.\"\n if \"cost\" in constraints:\n raise error(\"more than one cost equation\", source.string, source.pos)\n\n cost = {}\n\n parse_cost_term(source, cost)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L626_C4", "label": "expression", "type": "expression", "loc": [626, 626], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "vector": [8, 1, 0.1518, 0.0002, 1, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a cost equation.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L627_C4", "label": "if", "type": "if", "loc": [627, 628], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "vector": [4, 1, 0.1521, 0.0005, 1, 0.74, 0.0909, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if \"cost\" in constraints:\n raise error(\"more than one cost equation\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L630_C4", "label": "cost =", "type": "assigned_variable", "loc": [630, 630], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "vector": [14, 1, 0.1527, 0.0002, 1, 0.74, 0.1818, 454, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "cost", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cost = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L632_C4", "label": "parse_cost_term()", "type": "expression", "loc": [632, 632], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "vector": [8, 1, 0.1532, 0.0002, 1, 0.74, 0.2727, 308, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "parse_cost_term", "arg_names": [], "import_names": [], "rhs_call_name": "parse_cost_term", "annotation": ""}, "snippet": " parse_cost_term(source, cost)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L633_C4", "label": "while", "type": "while", "loc": [633, 634], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "vector": [5, 1, 0.1536, 0.0005, 1, 0.74, 0.3636, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while source.match(\"+\"):\n parse_cost_term(source, cost)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L634_C8", "label": "parse_cost_term()", "type": "expression", "loc": [634, 634], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L633_C4", "vector": [8, 2, 0.1537, 0.0002, 2, 0.32, 0.0, 308, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "parse_cost_term", "arg_names": [], "import_names": [], "rhs_call_name": "parse_cost_term", "annotation": ""}, "snippet": " parse_cost_term(source, cost)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L636_C4", "label": "max_inc = parse_fuzzy_compare()", "type": "assigned_variable", "loc": [636, 636], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "vector": [14, 1, 0.1542, 0.0002, 1, 0.74, 0.4545, 88, 3, 1, 0, 0, 965, 10, 1], "semantic": {"name": "max_inc", "arg_names": [], "import_names": [], "rhs_call_name": "parse_fuzzy_compare", "annotation": ""}, "snippet": " max_inc = parse_fuzzy_compare(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L637_C4", "label": "if", "type": "if", "loc": [637, 638], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "vector": [4, 1, 0.1545, 0.0005, 1, 0.74, 0.5455, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if max_inc is None:\n raise error(\"missing fuzzy cost limit\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L640_C4", "label": "max_cost = int()", "type": "assigned_variable", "loc": [640, 640], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "vector": [14, 1, 0.1552, 0.0002, 1, 0.74, 0.6364, 467, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "max_cost", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " max_cost = int(parse_count(source))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L642_C4", "label": "if", "type": "if", "loc": [642, 643], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "vector": [4, 1, 0.1558, 0.0005, 1, 0.74, 0.7273, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not max_inc:\n max_cost -= 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L645_C4", "label": "if", "type": "if", "loc": [645, 646], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "vector": [4, 1, 0.1565, 0.0005, 1, 0.74, 0.8182, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if max_cost < 0:\n raise error(\"bad fuzzy cost limit\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L648_C4", "label": "assign", "type": "assigned_variable", "loc": [648, 648], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "vector": [14, 1, 0.1571, 0.0002, 1, 0.74, 0.9091, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cost[\"max\"] = max_cost"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L650_C4", "label": "assign", "type": "assigned_variable", "loc": [650, 650], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "vector": [14, 1, 0.1576, 0.0002, 1, 0.74, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " constraints[\"cost\"] = cost"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L652_C0", "label": "parse_cost_term", "type": "function", "loc": [652, 662], "level": 0, "parent": null, "vector": [2, 0, 0.1593, 0.0027, 0, 0.66, 0.4197, 308, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "parse_cost_term", "arg_names": ["source", "cost"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_cost_term(source, cost):\n \"Parses a cost equation term.\"\n coeff = parse_count(source)\n ch = source.get()\n if ch not in \"dis\":\n raise ParseError()\n\n if ch in cost:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L653_C4", "label": "expression", "type": "expression", "loc": [653, 653], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L652_C0", "vector": [8, 1, 0.1583, 0.0002, 1, 0.48, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a cost equation term.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L654_C4", "label": "coeff = parse_count()", "type": "assigned_variable", "loc": [654, 654], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L652_C0", "vector": [14, 1, 0.1585, 0.0002, 1, 0.48, 0.2, 81, 3, 1, 0, 0, 384, 10, 1], "semantic": {"name": "coeff", "arg_names": [], "import_names": [], "rhs_call_name": "parse_count", "annotation": ""}, "snippet": " coeff = parse_count(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L655_C4", "label": "ch = get()", "type": "assigned_variable", "loc": [655, 655], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L652_C0", "vector": [14, 1, 0.1588, 0.0002, 1, 0.48, 0.4, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L656_C4", "label": "if", "type": "if", "loc": [656, 657], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L652_C0", "vector": [4, 1, 0.1592, 0.0005, 1, 0.48, 0.6, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch not in \"dis\":\n raise ParseError()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L659_C4", "label": "if", "type": "if", "loc": [659, 660], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L652_C0", "vector": [4, 1, 0.1599, 0.0005, 1, 0.48, 0.8, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch in cost:\n raise error(\"repeated fuzzy cost\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L662_C4", "label": " = int()", "type": "assigned_variable", "loc": [662, 662], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L652_C0", "vector": [14, 1, 0.1605, 0.0002, 1, 0.48, 1.0, 0, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " cost[ch] = int(coeff or 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L664_C0", "label": "parse_count", "type": "function", "loc": [664, 666], "level": 0, "parent": null, "vector": [2, 0, 0.1612, 0.0007, 0, 0.66, 0.4249, 384, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "parse_count", "arg_names": ["source"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_count(source):\n \"Parses a quantifier's count, which can be empty.\"\n return source.get_while(DIGITS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L665_C4", "label": "expression", "type": "expression", "loc": [665, 665], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L664_C0", "vector": [8, 1, 0.1612, 0.0002, 1, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a quantifier's count, which can be empty.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L666_C4", "label": "return", "type": "return", "loc": [666, 666], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L664_C0", "vector": [13, 1, 0.1615, 0.0002, 1, 0.18, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return source.get_while(DIGITS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L668_C0", "label": "parse_literal_and_element", "type": "function", "loc": [668, 738], "level": 0, "parent": null, "vector": [2, 0, 0.1704, 0.0172, 0, 0.66, 0.4301, 179, 0, 2, 1, 0, 0, 0, 18], "semantic": {"name": "parse_literal_and_element", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_literal_and_element(source, info):\n \"\"\"Parses a literal followed by an element. The element is FLAGS if it's an\n inline flag or None if it has reached the end of a sequence.\n \"\"\"\n characters = []\n case_flags = info.flags & CASE_FLAGS\n while True:\n saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L669_C4", "label": "expression", "type": "expression", "loc": [669, 671], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L668_C0", "vector": [8, 1, 0.1624, 0.0007, 1, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Parses a literal followed by an element. The element is FLAGS if it's an\n inline flag or None if it has reached the end of a sequence.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L672_C4", "label": "characters =", "type": "assigned_variable", "loc": [672, 672], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L668_C0", "vector": [14, 1, 0.1629, 0.0002, 1, 0.55, 0.3333, 731, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "characters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " characters = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L673_C4", "label": "case_flags =", "type": "assigned_variable", "loc": [673, 673], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L668_C0", "vector": [14, 1, 0.1632, 0.0002, 1, 0.55, 0.6667, 912, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "case_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " case_flags = info.flags & CASE_FLAGS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L674_C4", "label": "while", "type": "while", "loc": [674, 738], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L668_C0", "vector": [5, 1, 0.1712, 0.0158, 1, 0.55, 1.0, 0, 1, 0, 0, 0, 0, 0, 18], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n saved_pos = source.pos\n ch = source.get()\n if ch in SPECIAL_CHARS:\n if ch in \")|\":\n # The end of a sequence. At the end of the pattern ch is \"\".\n source.pos = saved_pos\n return characters, case_flags, None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L675_C8", "label": "saved_pos =", "type": "assigned_variable", "loc": [675, 675], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L674_C4", "vector": [14, 2, 0.1636, 0.0002, 2, 0.36, 0.0, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L676_C8", "label": "ch = get()", "type": "assigned_variable", "loc": [676, 676], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L674_C4", "vector": [14, 2, 0.1639, 0.0002, 2, 0.36, 0.5, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L677_C8", "label": "if", "type": "if", "loc": [677, 738], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L674_C4", "vector": [4, 2, 0.1715, 0.015, 2, 0.36, 1.0, 0, 0, 0, 0, 0, 0, 0, 17], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch in SPECIAL_CHARS:\n if ch in \")|\":\n # The end of a sequence. At the end of the pattern ch is \"\".\n source.pos = saved_pos\n return characters, case_flags, None\n elif ch == \"\\\\\":\n # An escape sequence outside a set.\n element = parse_escape(source, info, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L678_C12", "label": "if", "type": "if", "loc": [678, 735], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L677_C8", "vector": [4, 3, 0.1713, 0.0141, 3, 0.18, 0.0, 0, 0, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch in \")|\":\n # The end of a sequence. At the end of the pattern ch is \"\".\n source.pos = saved_pos\n return characters, case_flags, None\n elif ch == \"\\\\\":\n # An escape sequence outside a set.\n element = parse_escape(source, info, False)\n return characters, case_flags, element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L680_C16", "label": "source.pos =", "type": "assigned_variable", "loc": [680, 680], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L678_C12", "vector": [14, 4, 0.1648, 0.0002, 4, 0.64, 0.0, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L681_C16", "label": "return", "type": "return", "loc": [681, 681], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L678_C12", "vector": [13, 4, 0.1651, 0.0002, 4, 0.64, 0.5, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return characters, case_flags, None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L682_C12", "label": "if", "type": "if", "loc": [682, 735], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L678_C12", "vector": [4, 4, 0.1718, 0.0131, 4, 0.64, 1.0, 0, 0, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ch == \"\\\\\":\n # An escape sequence outside a set.\n element = parse_escape(source, info, False)\n return characters, case_flags, element\n elif ch == \"(\":\n # A parenthesised subpattern or a flag.\n element = parse_paren(source, info)\n if element and element is not COMMENT:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L684_C16", "label": "element = parse_escape()", "type": "assigned_variable", "loc": [684, 684], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L682_C12", "vector": [14, 5, 0.1658, 0.0002, 5, 0.96, 0.0, 736, 3, 3, 0, 0, 66, 10, 1], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "parse_escape", "annotation": ""}, "snippet": " element = parse_escape(source, info, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L685_C16", "label": "return", "type": "return", "loc": [685, 685], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L682_C12", "vector": [13, 5, 0.1661, 0.0002, 5, 0.96, 0.5, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return characters, case_flags, element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L686_C12", "label": "if", "type": "if", "loc": [686, 735], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L682_C12", "vector": [4, 5, 0.1722, 0.0121, 5, 0.96, 1.0, 0, 0, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ch == \"(\":\n # A parenthesised subpattern or a flag.\n element = parse_paren(source, info)\n if element and element is not COMMENT:\n return characters, case_flags, element\n elif ch == \".\":\n # Any character.\n if info.flags & DOTALL:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L688_C16", "label": "element = parse_paren()", "type": "assigned_variable", "loc": [688, 688], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L686_C12", "vector": [14, 6, 0.1668, 0.0002, 6, 0.37, 0.0, 736, 3, 2, 0, 0, 442, 10, 1], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "parse_paren", "annotation": ""}, "snippet": " element = parse_paren(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L689_C16", "label": "if", "type": "if", "loc": [689, 690], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L686_C12", "vector": [4, 6, 0.1672, 0.0005, 6, 0.37, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if element and element is not COMMENT:\n return characters, case_flags, element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L690_C20", "label": "return", "type": "return", "loc": [690, 690], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L689_C16", "vector": [13, 7, 0.1673, 0.0002, 7, 0.32, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return characters, case_flags, element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L691_C12", "label": "if", "type": "if", "loc": [691, 735], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L686_C12", "vector": [4, 6, 0.1728, 0.0109, 6, 0.37, 1.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ch == \".\":\n # Any character.\n if info.flags & DOTALL:\n element = AnyAll()\n elif info.flags & WORD:\n element = AnyU()\n else:\n element = Any()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L693_C16", "label": "if", "type": "if", "loc": [693, 698], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L691_C12", "vector": [4, 7, 0.1686, 0.0015, 7, 0.87, 0.0, 0, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if info.flags & DOTALL:\n element = AnyAll()\n elif info.flags & WORD:\n element = AnyU()\n else:\n element = Any()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L694_C20", "label": "element = AnyAll()", "type": "assigned_variable", "loc": [694, 694], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L693_C16", "vector": [14, 8, 0.1682, 0.0002, 8, 0.43, 0.0, 736, 3, 0, 0, 0, 871, 10, 1], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "AnyAll", "annotation": ""}, "snippet": " element = AnyAll()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L695_C16", "label": "if", "type": "if", "loc": [695, 698], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L693_C16", "vector": [4, 8, 0.1688, 0.001, 8, 0.43, 1.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif info.flags & WORD:\n element = AnyU()\n else:\n element = Any()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L696_C20", "label": "element = AnyU()", "type": "assigned_variable", "loc": [696, 696], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L695_C16", "vector": [14, 9, 0.1687, 0.0002, 9, 0.11, 0.0, 736, 3, 0, 0, 0, 710, 10, 1], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "AnyU", "annotation": ""}, "snippet": " element = AnyU()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L698_C20", "label": "element = Any()", "type": "assigned_variable", "loc": [698, 698], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L695_C16", "vector": [14, 9, 0.1692, 0.0002, 9, 0.11, 1.0, 736, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "Any", "annotation": ""}, "snippet": " element = Any()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L700_C16", "label": "return", "type": "return", "loc": [700, 700], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L691_C12", "vector": [13, 7, 0.1697, 0.0002, 7, 0.87, 0.5, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return characters, case_flags, element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L701_C12", "label": "if", "type": "if", "loc": [701, 735], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L691_C12", "vector": [4, 7, 0.1741, 0.0085, 7, 0.87, 1.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ch == \"[\":\n # A character set.\n element = parse_set(source, info)\n return characters, case_flags, element\n elif ch == \"^\":\n # The start of a line or the string.\n if info.flags & MULTILINE:\n if info.flags & WORD:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L703_C16", "label": "element = parse_set()", "type": "assigned_variable", "loc": [703, 703], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L701_C12", "vector": [14, 8, 0.1704, 0.0002, 8, 0.62, 0.0, 736, 3, 2, 0, 0, 289, 10, 1], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "parse_set", "annotation": ""}, "snippet": " element = parse_set(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L704_C16", "label": "return", "type": "return", "loc": [704, 704], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L701_C12", "vector": [13, 8, 0.1707, 0.0002, 8, 0.62, 0.5, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return characters, case_flags, element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L705_C12", "label": "if", "type": "if", "loc": [705, 735], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L701_C12", "vector": [4, 8, 0.1745, 0.0075, 8, 0.62, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ch == \"^\":\n # The start of a line or the string.\n if info.flags & MULTILINE:\n if info.flags & WORD:\n element = StartOfLineU()\n else:\n element = StartOfLine()\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L707_C16", "label": "if", "type": "if", "loc": [707, 713], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L705_C12", "vector": [4, 9, 0.1721, 0.0017, 9, 0.06, 0.0, 0, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if info.flags & MULTILINE:\n if info.flags & WORD:\n element = StartOfLineU()\n else:\n element = StartOfLine()\n else:\n element = StartOfString()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L708_C20", "label": "if", "type": "if", "loc": [708, 711], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L707_C16", "vector": [4, 10, 0.172, 0.001, 10, 0.86, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if info.flags & WORD:\n element = StartOfLineU()\n else:\n element = StartOfLine()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L709_C24", "label": "element = StartOfLineU()", "type": "assigned_variable", "loc": [709, 709], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L708_C20", "vector": [14, 11, 0.1719, 0.0002, 11, 0.44, 0.0, 736, 3, 0, 0, 0, 153, 10, 1], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "StartOfLineU", "annotation": ""}, "snippet": " element = StartOfLineU()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L711_C24", "label": "element = StartOfLine()", "type": "assigned_variable", "loc": [711, 711], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L708_C20", "vector": [14, 11, 0.1724, 0.0002, 11, 0.44, 1.0, 736, 3, 0, 0, 0, 819, 10, 1], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "StartOfLine", "annotation": ""}, "snippet": " element = StartOfLine()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L713_C20", "label": "element = StartOfString()", "type": "assigned_variable", "loc": [713, 713], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L707_C16", "vector": [14, 10, 0.1728, 0.0002, 10, 0.86, 1.0, 736, 3, 0, 0, 0, 656, 10, 1], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "StartOfString", "annotation": ""}, "snippet": " element = StartOfString()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L715_C16", "label": "return", "type": "return", "loc": [715, 715], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L705_C12", "vector": [13, 9, 0.1733, 0.0002, 9, 0.06, 0.5, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return characters, case_flags, element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L716_C12", "label": "if", "type": "if", "loc": [716, 735], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L705_C12", "vector": [4, 9, 0.1759, 0.0048, 9, 0.06, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ch == \"$\":\n # The end of a line or the string.\n if info.flags & MULTILINE:\n if info.flags & WORD:\n element = EndOfLineU()\n else:\n element = EndOfLine()\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L718_C16", "label": "if", "type": "if", "loc": [718, 727], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L716_C12", "vector": [4, 10, 0.1752, 0.0024, 10, 0.23, 0.0, 0, 4, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if info.flags & MULTILINE:\n if info.flags & WORD:\n element = EndOfLineU()\n else:\n element = EndOfLine()\n else:\n if info.flags & WORD:\n element = EndOfStringLineU()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L719_C20", "label": "if", "type": "if", "loc": [719, 722], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L718_C16", "vector": [4, 11, 0.1747, 0.001, 11, 0.51, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if info.flags & WORD:\n element = EndOfLineU()\n else:\n element = EndOfLine()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L720_C24", "label": "element = EndOfLineU()", "type": "assigned_variable", "loc": [720, 720], "level": 12, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L719_C20", "vector": [14, 12, 0.1745, 0.0002, 12, 0.5, 0.0, 736, 3, 0, 0, 0, 398, 10, 1], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "EndOfLineU", "annotation": ""}, "snippet": " element = EndOfLineU()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L722_C24", "label": "element = EndOfLine()", "type": "assigned_variable", "loc": [722, 722], "level": 12, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L719_C20", "vector": [14, 12, 0.175, 0.0002, 12, 0.5, 1.0, 736, 3, 0, 0, 0, 748, 10, 1], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "EndOfLine", "annotation": ""}, "snippet": " element = EndOfLine()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L724_C20", "label": "if", "type": "if", "loc": [724, 727], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L718_C16", "vector": [4, 11, 0.1759, 0.001, 11, 0.51, 1.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if info.flags & WORD:\n element = EndOfStringLineU()\n else:\n element = EndOfStringLine()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L725_C24", "label": "element = EndOfStringLineU()", "type": "assigned_variable", "loc": [725, 725], "level": 12, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L724_C20", "vector": [14, 12, 0.1758, 0.0002, 12, 0.01, 0.0, 736, 3, 0, 0, 0, 276, 10, 1], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "EndOfStringLineU", "annotation": ""}, "snippet": " element = EndOfStringLineU()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L727_C24", "label": "element = EndOfStringLine()", "type": "assigned_variable", "loc": [727, 727], "level": 12, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L724_C20", "vector": [14, 12, 0.1762, 0.0002, 12, 0.01, 1.0, 736, 3, 0, 0, 0, 305, 10, 1], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "EndOfStringLine", "annotation": ""}, "snippet": " element = EndOfStringLine()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L729_C16", "label": "return", "type": "return", "loc": [729, 729], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L716_C12", "vector": [13, 10, 0.1767, 0.0002, 10, 0.23, 0.5, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return characters, case_flags, element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L730_C12", "label": "if", "type": "if", "loc": [730, 735], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L716_C12", "vector": [4, 10, 0.1776, 0.0015, 10, 0.23, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ch in \"?*+{\":\n # Looks like a quantifier.\n return characters, case_flags, (ch, saved_pos)\n else:\n # A literal.\n characters.append(ord(ch))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L732_C16", "label": "return", "type": "return", "loc": [732, 732], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L730_C12", "vector": [13, 11, 0.1775, 0.0002, 11, 0.87, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return characters, case_flags, (ch, saved_pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L735_C16", "label": "append()", "type": "expression", "loc": [735, 735], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L730_C12", "vector": [8, 11, 0.1782, 0.0002, 11, 0.87, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " characters.append(ord(ch))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L738_C12", "label": "append()", "type": "expression", "loc": [738, 738], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L677_C8", "vector": [8, 3, 0.1789, 0.0002, 3, 0.18, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " characters.append(ord(ch))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "label": "parse_paren", "type": "function", "loc": [740, 815], "level": 0, "parent": null, "vector": [2, 0, 0.1885, 0.0184, 0, 0.66, 0.4352, 442, 0, 2, 1, 0, 0, 0, 27], "semantic": {"name": "parse_paren", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_paren(source, info):\n \"\"\"Parses a parenthesised subpattern or a flag. Returns FLAGS if it's an\n inline flag.\n \"\"\"\n saved_pos = source.pos\n ch = source.get()\n if ch == \"?\":\n # (?..."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L741_C4", "label": "expression", "type": "expression", "loc": [741, 743], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "vector": [8, 1, 0.1799, 0.0007, 1, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Parses a parenthesised subpattern or a flag. Returns FLAGS if it's an\n inline flag.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L744_C4", "label": "saved_pos =", "type": "assigned_variable", "loc": [744, 744], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "vector": [14, 1, 0.1804, 0.0002, 1, 0.79, 0.1111, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L745_C4", "label": "ch = get()", "type": "assigned_variable", "loc": [745, 745], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "vector": [14, 1, 0.1806, 0.0002, 1, 0.79, 0.2222, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "label": "if", "type": "if", "loc": [746, 800], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "vector": [4, 1, 0.1874, 0.0133, 1, 0.79, 0.3333, 0, 0, 0, 0, 0, 0, 0, 20], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"?\":\n # (?...\n saved_pos_2 = source.pos\n ch = source.get()\n if ch == \"<\":\n # (?<...\n saved_pos_3 = source.pos\n ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L748_C8", "label": "saved_pos_2 =", "type": "assigned_variable", "loc": [748, 748], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "vector": [14, 2, 0.1813, 0.0002, 2, 0.16, 0.0, 892, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos_2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos_2 = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L749_C8", "label": "ch = get()", "type": "assigned_variable", "loc": [749, 749], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "vector": [14, 2, 0.1816, 0.0002, 2, 0.16, 0.0833, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "label": "if", "type": "if", "loc": [750, 772], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "vector": [4, 2, 0.1845, 0.0056, 2, 0.16, 0.1667, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"<\":\n # (?<...\n saved_pos_3 = source.pos\n ch = source.get()\n if ch in (\"=\", \"!\"):\n # (?<=... or (?<!...: lookbehind.\n return parse_lookaround(source, info, True, ch == \"=\")\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L752_C12", "label": "saved_pos_3 =", "type": "assigned_variable", "loc": [752, 752], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "vector": [14, 3, 0.1823, 0.0002, 3, 0.74, 0.0, 473, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos_3", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos_3 = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L753_C12", "label": "ch = get()", "type": "assigned_variable", "loc": [753, 753], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "vector": [14, 3, 0.1825, 0.0002, 3, 0.74, 0.1, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L754_C12", "label": "if", "type": "if", "loc": [754, 756], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "vector": [4, 3, 0.183, 0.0007, 3, 0.74, 0.2, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch in (\"=\", \"!\"):\n # (?<=... or (?<!...: lookbehind.\n return parse_lookaround(source, info, True, ch == \"=\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L756_C16", "label": "return", "type": "return", "loc": [756, 756], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L754_C12", "vector": [13, 4, 0.1833, 0.0002, 4, 0.15, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_lookaround(source, info, True, ch == \"=\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L759_C12", "label": "source.pos =", "type": "assigned_variable", "loc": [759, 759], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "vector": [14, 3, 0.184, 0.0002, 3, 0.74, 0.3, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos_3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L760_C12", "label": "name = parse_name()", "type": "assigned_variable", "loc": [760, 760], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "vector": [14, 3, 0.1842, 0.0002, 3, 0.74, 0.4, 57, 3, 1, 0, 0, 382, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "parse_name", "annotation": ""}, "snippet": " name = parse_name(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L761_C12", "label": "group = open_group()", "type": "assigned_variable", "loc": [761, 761], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "vector": [14, 3, 0.1845, 0.0002, 3, 0.74, 0.5, 43, 3, 1, 0, 0, 857, 10, 1], "semantic": {"name": "group", "arg_names": [], "import_names": [], "rhs_call_name": "open_group", "annotation": ""}, "snippet": " group = info.open_group(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L762_C12", "label": "expect()", "type": "expression", "loc": [762, 762], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "vector": [8, 3, 0.1847, 0.0002, 3, 0.74, 0.6, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\">\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L763_C12", "label": "saved_flags =", "type": "assigned_variable", "loc": [763, 763], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "vector": [14, 3, 0.185, 0.0002, 3, 0.74, 0.7, 840, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_flags = info.flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L764_C12", "label": "try", "type": "try", "loc": [764, 769], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "vector": [7, 3, 0.1858, 0.0015, 3, 0.74, 0.8, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n subpattern = _parse_pattern(source, info)\n source.expect(\")\")\n finally:\n info.flags = saved_flags\n source.ignore_space = bool(info.flags & VERBOSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L765_C16", "label": "subpattern = _parse_pattern()", "type": "assigned_variable", "loc": [765, 765], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L764_C12", "vector": [14, 4, 0.1855, 0.0002, 4, 0.34, 0.0, 276, 3, 2, 0, 0, 68, 10, 1], "semantic": {"name": "subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "_parse_pattern", "annotation": ""}, "snippet": " subpattern = _parse_pattern(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L766_C16", "label": "expect()", "type": "expression", "loc": [766, 766], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L764_C12", "vector": [8, 4, 0.1857, 0.0002, 4, 0.34, 0.3333, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L768_C16", "label": "info.flags =", "type": "assigned_variable", "loc": [768, 768], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L764_C12", "vector": [14, 4, 0.1862, 0.0002, 4, 0.34, 0.6667, 121, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "info.flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " info.flags = saved_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L769_C16", "label": "source.ignore_space = bool()", "type": "assigned_variable", "loc": [769, 769], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L764_C12", "vector": [14, 4, 0.1864, 0.0002, 4, 0.34, 1.0, 890, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "source.ignore_space", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " source.ignore_space = bool(info.flags & VERBOSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L771_C12", "label": "close_group()", "type": "expression", "loc": [771, 771], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "vector": [8, 3, 0.1869, 0.0002, 3, 0.74, 0.9, 764, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close_group", "arg_names": [], "import_names": [], "rhs_call_name": "close_group", "annotation": ""}, "snippet": " info.close_group()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L772_C12", "label": "return", "type": "return", "loc": [772, 772], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "vector": [13, 3, 0.1872, 0.0002, 3, 0.74, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Group(info, group, subpattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L773_C8", "label": "if", "type": "if", "loc": [773, 775], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "vector": [4, 2, 0.1876, 0.0007, 2, 0.16, 0.25, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch in (\"=\", \"!\"):\n # (?=... or (?!...: lookahead.\n return parse_lookaround(source, info, False, ch == \"=\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L775_C12", "label": "return", "type": "return", "loc": [775, 775], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L773_C8", "vector": [13, 3, 0.1879, 0.0002, 3, 0.11, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_lookaround(source, info, False, ch == \"=\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L776_C8", "label": "if", "type": "if", "loc": [776, 778], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "vector": [4, 2, 0.1884, 0.0007, 2, 0.16, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"P\":\n # (?P...: a Python extension.\n return parse_extension(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L778_C12", "label": "return", "type": "return", "loc": [778, 778], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L776_C8", "vector": [13, 3, 0.1886, 0.0002, 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 parse_extension(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L779_C8", "label": "if", "type": "if", "loc": [779, 781], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "vector": [4, 2, 0.1891, 0.0007, 2, 0.16, 0.4167, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"#\":\n # (?#...: a comment.\n return parse_comment(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L781_C12", "label": "return", "type": "return", "loc": [781, 781], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L779_C8", "vector": [13, 3, 0.1893, 0.0002, 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 parse_comment(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L782_C8", "label": "if", "type": "if", "loc": [782, 784], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "vector": [4, 2, 0.1898, 0.0007, 2, 0.16, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"(\":\n # (?(...: a conditional subpattern.\n return parse_conditional(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L784_C12", "label": "return", "type": "return", "loc": [784, 784], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L782_C8", "vector": [13, 3, 0.1901, 0.0002, 3, 0.26, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_conditional(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L785_C8", "label": "if", "type": "if", "loc": [785, 787], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "vector": [4, 2, 0.1905, 0.0007, 2, 0.16, 0.5833, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \">\":\n # (?>...: an atomic subpattern.\n return parse_atomic(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L787_C12", "label": "return", "type": "return", "loc": [787, 787], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L785_C8", "vector": [13, 3, 0.1908, 0.0002, 3, 0.76, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_atomic(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L788_C8", "label": "if", "type": "if", "loc": [788, 790], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "vector": [4, 2, 0.1913, 0.0007, 2, 0.16, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"|\":\n # (?|...: a common/reset groups branch.\n return parse_common(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L790_C12", "label": "return", "type": "return", "loc": [790, 790], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L788_C8", "vector": [13, 3, 0.1915, 0.0002, 3, 0.35, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_common(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L791_C8", "label": "if", "type": "if", "loc": [791, 793], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "vector": [4, 2, 0.192, 0.0007, 2, 0.16, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"R\" or \"0\" <= ch <= \"9\":\n # (?R...: probably a call to a group.\n return parse_call_group(source, info, ch, saved_pos_2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L793_C12", "label": "return", "type": "return", "loc": [793, 793], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L791_C8", "vector": [13, 3, 0.1922, 0.0002, 3, 0.48, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_call_group(source, info, ch, saved_pos_2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L794_C8", "label": "if", "type": "if", "loc": [794, 796], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "vector": [4, 2, 0.1927, 0.0007, 2, 0.16, 0.8333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"&\":\n # (?&...: a call to a named group.\n return parse_call_named_group(source, info, saved_pos_2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L796_C12", "label": "return", "type": "return", "loc": [796, 796], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L794_C8", "vector": [13, 3, 0.193, 0.0002, 3, 0.81, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_call_named_group(source, info, saved_pos_2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L799_C8", "label": "source.pos =", "type": "assigned_variable", "loc": [799, 799], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "vector": [14, 2, 0.1937, 0.0002, 2, 0.16, 0.9167, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos_2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L800_C8", "label": "return", "type": "return", "loc": [800, 800], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "vector": [13, 2, 0.1939, 0.0002, 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 parse_flags_subpattern(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L803_C4", "label": "source.pos =", "type": "assigned_variable", "loc": [803, 803], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "vector": [14, 1, 0.1947, 0.0002, 1, 0.79, 0.4444, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L804_C4", "label": "group = open_group()", "type": "assigned_variable", "loc": [804, 804], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "vector": [14, 1, 0.1949, 0.0002, 1, 0.79, 0.5556, 43, 3, 0, 0, 0, 857, 10, 1], "semantic": {"name": "group", "arg_names": [], "import_names": [], "rhs_call_name": "open_group", "annotation": ""}, "snippet": " group = info.open_group()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L805_C4", "label": "saved_flags =", "type": "assigned_variable", "loc": [805, 805], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "vector": [14, 1, 0.1952, 0.0002, 1, 0.79, 0.6667, 840, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_flags = info.flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L806_C4", "label": "try", "type": "try", "loc": [806, 811], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "vector": [7, 1, 0.196, 0.0015, 1, 0.79, 0.7778, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n subpattern = _parse_pattern(source, info)\n source.expect(\")\")\n finally:\n info.flags = saved_flags\n source.ignore_space = bool(info.flags & VERBOSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L807_C8", "label": "subpattern = _parse_pattern()", "type": "assigned_variable", "loc": [807, 807], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L806_C4", "vector": [14, 2, 0.1956, 0.0002, 2, 0.23, 0.0, 276, 3, 2, 0, 0, 68, 10, 1], "semantic": {"name": "subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "_parse_pattern", "annotation": ""}, "snippet": " subpattern = _parse_pattern(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L808_C8", "label": "expect()", "type": "expression", "loc": [808, 808], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L806_C4", "vector": [8, 2, 0.1959, 0.0002, 2, 0.23, 0.3333, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L810_C8", "label": "info.flags =", "type": "assigned_variable", "loc": [810, 810], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L806_C4", "vector": [14, 2, 0.1964, 0.0002, 2, 0.23, 0.6667, 121, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "info.flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " info.flags = saved_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L811_C8", "label": "source.ignore_space = bool()", "type": "assigned_variable", "loc": [811, 811], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L806_C4", "vector": [14, 2, 0.1966, 0.0002, 2, 0.23, 1.0, 890, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "source.ignore_space", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " source.ignore_space = bool(info.flags & VERBOSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L813_C4", "label": "close_group()", "type": "expression", "loc": [813, 813], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "vector": [8, 1, 0.1971, 0.0002, 1, 0.79, 0.8889, 764, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close_group", "arg_names": [], "import_names": [], "rhs_call_name": "close_group", "annotation": ""}, "snippet": " info.close_group()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L815_C4", "label": "return", "type": "return", "loc": [815, 815], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "vector": [13, 1, 0.1976, 0.0002, 1, 0.79, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Group(info, group, subpattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L817_C0", "label": "parse_extension", "type": "function", "loc": [817, 851], "level": 0, "parent": null, "vector": [2, 0, 0.2022, 0.0085, 0, 0.66, 0.4404, 425, 0, 2, 1, 0, 0, 0, 16], "semantic": {"name": "parse_extension", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_extension(source, info):\n \"Parses a Python extension.\"\n saved_pos = source.pos\n ch = source.get()\n if ch == \"<\":\n # (?P<...: a named capture group.\n name = parse_name(source)\n group = info.open_group(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L818_C4", "label": "expression", "type": "expression", "loc": [818, 818], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L817_C0", "vector": [8, 1, 0.1983, 0.0002, 1, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a Python extension.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L819_C4", "label": "saved_pos =", "type": "assigned_variable", "loc": [819, 819], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L817_C0", "vector": [14, 1, 0.1985, 0.0002, 1, 0.04, 0.1667, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L820_C4", "label": "ch = get()", "type": "assigned_variable", "loc": [820, 820], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L817_C0", "vector": [14, 1, 0.1988, 0.0002, 1, 0.04, 0.3333, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L821_C4", "label": "if", "type": "if", "loc": [821, 836], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L817_C0", "vector": [4, 1, 0.2008, 0.0039, 1, 0.04, 0.5, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"<\":\n # (?P<...: a named capture group.\n name = parse_name(source)\n group = info.open_group(name)\n source.expect(\">\")\n saved_flags = info.flags\n try:\n subpattern = _parse_pattern(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L823_C8", "label": "name = parse_name()", "type": "assigned_variable", "loc": [823, 823], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L821_C4", "vector": [14, 2, 0.1995, 0.0002, 2, 0.48, 0.0, 57, 3, 1, 0, 0, 382, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "parse_name", "annotation": ""}, "snippet": " name = parse_name(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L824_C8", "label": "group = open_group()", "type": "assigned_variable", "loc": [824, 824], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L821_C4", "vector": [14, 2, 0.1998, 0.0002, 2, 0.48, 0.1667, 43, 3, 1, 0, 0, 857, 10, 1], "semantic": {"name": "group", "arg_names": [], "import_names": [], "rhs_call_name": "open_group", "annotation": ""}, "snippet": " group = info.open_group(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L825_C8", "label": "expect()", "type": "expression", "loc": [825, 825], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L821_C4", "vector": [8, 2, 0.2, 0.0002, 2, 0.48, 0.3333, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\">\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L826_C8", "label": "saved_flags =", "type": "assigned_variable", "loc": [826, 826], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L821_C4", "vector": [14, 2, 0.2002, 0.0002, 2, 0.48, 0.5, 840, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_flags = info.flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L827_C8", "label": "try", "type": "try", "loc": [827, 832], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L821_C4", "vector": [7, 2, 0.2011, 0.0015, 2, 0.48, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n subpattern = _parse_pattern(source, info)\n source.expect(\")\")\n finally:\n info.flags = saved_flags\n source.ignore_space = bool(info.flags & VERBOSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L828_C12", "label": "subpattern = _parse_pattern()", "type": "assigned_variable", "loc": [828, 828], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L827_C8", "vector": [14, 3, 0.2007, 0.0002, 3, 0.53, 0.0, 276, 3, 2, 0, 0, 68, 10, 1], "semantic": {"name": "subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "_parse_pattern", "annotation": ""}, "snippet": " subpattern = _parse_pattern(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L829_C12", "label": "expect()", "type": "expression", "loc": [829, 829], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L827_C8", "vector": [8, 3, 0.201, 0.0002, 3, 0.53, 0.3333, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L831_C12", "label": "info.flags =", "type": "assigned_variable", "loc": [831, 831], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L827_C8", "vector": [14, 3, 0.2015, 0.0002, 3, 0.53, 0.6667, 121, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "info.flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " info.flags = saved_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L832_C12", "label": "source.ignore_space = bool()", "type": "assigned_variable", "loc": [832, 832], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L827_C8", "vector": [14, 3, 0.2017, 0.0002, 3, 0.53, 1.0, 890, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "source.ignore_space", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " source.ignore_space = bool(info.flags & VERBOSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L834_C8", "label": "close_group()", "type": "expression", "loc": [834, 834], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L821_C4", "vector": [8, 2, 0.2022, 0.0002, 2, 0.48, 0.8333, 764, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close_group", "arg_names": [], "import_names": [], "rhs_call_name": "close_group", "annotation": ""}, "snippet": " info.close_group()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L836_C8", "label": "return", "type": "return", "loc": [836, 836], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L821_C4", "vector": [13, 2, 0.2027, 0.0002, 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 Group(info, group, subpattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L837_C4", "label": "if", "type": "if", "loc": [837, 845], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L817_C0", "vector": [4, 1, 0.2039, 0.0022, 1, 0.04, 0.6667, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"=\":\n # (?P=...: a named group reference.\n name = parse_name(source, allow_numeric=True)\n source.expect(\")\")\n if info.is_open_group(name):\n raise error(\"cannot refer to an open group\", source.string,\n saved_pos)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L839_C8", "label": "name = parse_name()", "type": "assigned_variable", "loc": [839, 839], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L837_C4", "vector": [14, 2, 0.2034, 0.0002, 2, 0.11, 0.0, 57, 3, 2, 0, 0, 382, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "parse_name", "annotation": ""}, "snippet": " name = parse_name(source, allow_numeric=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L840_C8", "label": "expect()", "type": "expression", "loc": [840, 840], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L837_C4", "vector": [8, 2, 0.2036, 0.0002, 2, 0.11, 0.3333, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L841_C8", "label": "if", "type": "if", "loc": [841, 843], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L837_C4", "vector": [4, 2, 0.2041, 0.0007, 2, 0.11, 0.6667, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if info.is_open_group(name):\n raise error(\"cannot refer to an open group\", source.string,\n saved_pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L845_C8", "label": "return", "type": "return", "loc": [845, 845], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L837_C4", "vector": [13, 2, 0.2048, 0.0002, 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 make_ref_group(info, name, saved_pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L846_C4", "label": "if", "type": "if", "loc": [846, 848], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L817_C0", "vector": [4, 1, 0.2053, 0.0007, 1, 0.04, 0.8333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \">\" or ch == \"&\":\n # (?P>...: a call to a group.\n return parse_call_named_group(source, info, saved_pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L848_C8", "label": "return", "type": "return", "loc": [848, 848], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L846_C4", "vector": [13, 2, 0.2056, 0.0002, 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 parse_call_named_group(source, info, saved_pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L850_C4", "label": "source.pos =", "type": "assigned_variable", "loc": [850, 850], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L817_C0", "vector": [14, 1, 0.2061, 0.0002, 1, 0.04, 1.0, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L853_C0", "label": "parse_comment", "type": "function", "loc": [853, 858], "level": 0, "parent": null, "vector": [2, 0, 0.2074, 0.0015, 0, 0.66, 0.4456, 286, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "parse_comment", "arg_names": ["source"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_comment(source):\n \"Parses a comment.\"\n source.skip_while(set(\")\"), include=False)\n source.expect(\")\")\n\n return COMMENT"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L854_C4", "label": "expression", "type": "expression", "loc": [854, 854], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L853_C0", "vector": [8, 1, 0.207, 0.0002, 1, 0.01, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a comment.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L855_C4", "label": "skip_while()", "type": "expression", "loc": [855, 855], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L853_C0", "vector": [8, 1, 0.2073, 0.0002, 1, 0.01, 0.3333, 410, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "skip_while", "arg_names": [], "import_names": [], "rhs_call_name": "skip_while", "annotation": ""}, "snippet": " source.skip_while(set(\")\"), include=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L856_C4", "label": "expect()", "type": "expression", "loc": [856, 856], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L853_C0", "vector": [8, 1, 0.2075, 0.0002, 1, 0.01, 0.6667, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L858_C4", "label": "return", "type": "return", "loc": [858, 858], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L853_C0", "vector": [13, 1, 0.208, 0.0002, 1, 0.01, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return COMMENT"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L860_C0", "label": "parse_lookaround", "type": "function", "loc": [860, 870], "level": 0, "parent": null, "vector": [2, 0, 0.2097, 0.0027, 0, 0.66, 0.4508, 919, 0, 4, 1, 0, 0, 0, 4], "semantic": {"name": "parse_lookaround", "arg_names": ["source", "info", "behind", "positive"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_lookaround(source, info, behind, positive):\n \"Parses a lookaround.\"\n saved_flags = info.flags\n try:\n subpattern = _parse_pattern(source, info)\n source.expect(\")\")\n finally:\n info.flags = saved_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L861_C4", "label": "expression", "type": "expression", "loc": [861, 861], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L860_C0", "vector": [8, 1, 0.2087, 0.0002, 1, 0.34, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a lookaround.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L862_C4", "label": "saved_flags =", "type": "assigned_variable", "loc": [862, 862], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L860_C0", "vector": [14, 1, 0.209, 0.0002, 1, 0.34, 0.3333, 840, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_flags = info.flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L863_C4", "label": "try", "type": "try", "loc": [863, 868], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L860_C0", "vector": [7, 1, 0.2098, 0.0015, 1, 0.34, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n subpattern = _parse_pattern(source, info)\n source.expect(\")\")\n finally:\n info.flags = saved_flags\n source.ignore_space = bool(info.flags & VERBOSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L864_C8", "label": "subpattern = _parse_pattern()", "type": "assigned_variable", "loc": [864, 864], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L863_C4", "vector": [14, 2, 0.2095, 0.0002, 2, 0.19, 0.0, 276, 3, 2, 0, 0, 68, 10, 1], "semantic": {"name": "subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "_parse_pattern", "annotation": ""}, "snippet": " subpattern = _parse_pattern(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L865_C8", "label": "expect()", "type": "expression", "loc": [865, 865], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L863_C4", "vector": [8, 2, 0.2097, 0.0002, 2, 0.19, 0.3333, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L867_C8", "label": "info.flags =", "type": "assigned_variable", "loc": [867, 867], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L863_C4", "vector": [14, 2, 0.2102, 0.0002, 2, 0.19, 0.6667, 121, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "info.flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " info.flags = saved_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L868_C8", "label": "source.ignore_space = bool()", "type": "assigned_variable", "loc": [868, 868], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L863_C4", "vector": [14, 2, 0.2104, 0.0002, 2, 0.19, 1.0, 890, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "source.ignore_space", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " source.ignore_space = bool(info.flags & VERBOSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L870_C4", "label": "return", "type": "return", "loc": [870, 870], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L860_C0", "vector": [13, 1, 0.2109, 0.0002, 1, 0.34, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return LookAround(behind, positive, subpattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L872_C0", "label": "parse_conditional", "type": "function", "loc": [872, 893], "level": 0, "parent": null, "vector": [2, 0, 0.2139, 0.0053, 0, 0.66, 0.456, 373, 0, 2, 1, 0, 0, 0, 12], "semantic": {"name": "parse_conditional", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_conditional(source, info):\n \"Parses a conditional subpattern.\"\n saved_flags = info.flags\n saved_pos = source.pos\n try:\n group = parse_name(source, True)\n source.expect(\")\")\n yes_branch = parse_sequence(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L873_C4", "label": "expression", "type": "expression", "loc": [873, 873], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L872_C0", "vector": [8, 1, 0.2116, 0.0002, 1, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a conditional subpattern.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L874_C4", "label": "saved_flags =", "type": "assigned_variable", "loc": [874, 874], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L872_C0", "vector": [14, 1, 0.2119, 0.0002, 1, 0.67, 0.2, 840, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_flags = info.flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L875_C4", "label": "saved_pos =", "type": "assigned_variable", "loc": [875, 875], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L872_C0", "vector": [14, 1, 0.2121, 0.0002, 1, 0.67, 0.4, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L876_C4", "label": "try", "type": "try", "loc": [876, 888], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L872_C0", "vector": [7, 1, 0.2138, 0.0032, 1, 0.67, 0.6, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n group = parse_name(source, True)\n source.expect(\")\")\n yes_branch = parse_sequence(source, info)\n if source.match(\"|\"):\n no_branch = parse_sequence(source, info)\n else:\n no_branch = Sequence()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L877_C8", "label": "group = parse_name()", "type": "assigned_variable", "loc": [877, 877], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L876_C4", "vector": [14, 2, 0.2126, 0.0002, 2, 0.72, 0.0, 43, 3, 2, 0, 0, 382, 10, 1], "semantic": {"name": "group", "arg_names": [], "import_names": [], "rhs_call_name": "parse_name", "annotation": ""}, "snippet": " group = parse_name(source, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L878_C8", "label": "expect()", "type": "expression", "loc": [878, 878], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L876_C4", "vector": [8, 2, 0.2128, 0.0002, 2, 0.72, 0.1667, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L879_C8", "label": "yes_branch = parse_sequence()", "type": "assigned_variable", "loc": [879, 879], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L876_C4", "vector": [14, 2, 0.2131, 0.0002, 2, 0.72, 0.3333, 935, 3, 2, 0, 0, 172, 10, 1], "semantic": {"name": "yes_branch", "arg_names": [], "import_names": [], "rhs_call_name": "parse_sequence", "annotation": ""}, "snippet": " yes_branch = parse_sequence(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L880_C8", "label": "if", "type": "if", "loc": [880, 883], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L876_C4", "vector": [4, 2, 0.2137, 0.001, 2, 0.72, 0.5, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source.match(\"|\"):\n no_branch = parse_sequence(source, info)\n else:\n no_branch = Sequence()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L881_C12", "label": "no_branch = parse_sequence()", "type": "assigned_variable", "loc": [881, 881], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L880_C8", "vector": [14, 3, 0.2136, 0.0002, 3, 0.43, 0.0, 830, 3, 2, 0, 0, 172, 10, 1], "semantic": {"name": "no_branch", "arg_names": [], "import_names": [], "rhs_call_name": "parse_sequence", "annotation": ""}, "snippet": " no_branch = parse_sequence(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L883_C12", "label": "no_branch = Sequence()", "type": "assigned_variable", "loc": [883, 883], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L880_C8", "vector": [14, 3, 0.2141, 0.0002, 3, 0.43, 1.0, 830, 3, 0, 0, 0, 853, 10, 1], "semantic": {"name": "no_branch", "arg_names": [], "import_names": [], "rhs_call_name": "Sequence", "annotation": ""}, "snippet": " no_branch = Sequence()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L885_C8", "label": "expect()", "type": "expression", "loc": [885, 885], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L876_C4", "vector": [8, 2, 0.2145, 0.0002, 2, 0.72, 0.6667, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L887_C8", "label": "info.flags =", "type": "assigned_variable", "loc": [887, 887], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L876_C4", "vector": [14, 2, 0.215, 0.0002, 2, 0.72, 0.8333, 121, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "info.flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " info.flags = saved_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L888_C8", "label": "source.ignore_space = bool()", "type": "assigned_variable", "loc": [888, 888], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L876_C4", "vector": [14, 2, 0.2153, 0.0002, 2, 0.72, 1.0, 890, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "source.ignore_space", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " source.ignore_space = bool(info.flags & VERBOSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L890_C4", "label": "if", "type": "if", "loc": [890, 891], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L872_C0", "vector": [4, 1, 0.2159, 0.0005, 1, 0.67, 0.8, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if yes_branch.is_empty() and no_branch.is_empty():\n return Sequence()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L891_C8", "label": "return", "type": "return", "loc": [891, 891], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L890_C4", "vector": [13, 2, 0.216, 0.0002, 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 Sequence()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L893_C4", "label": "return", "type": "return", "loc": [893, 893], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L872_C0", "vector": [13, 1, 0.2165, 0.0002, 1, 0.67, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Conditional(info, group, yes_branch, no_branch, saved_pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L895_C0", "label": "parse_atomic", "type": "function", "loc": [895, 905], "level": 0, "parent": null, "vector": [2, 0, 0.2182, 0.0027, 0, 0.66, 0.4611, 491, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "parse_atomic", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_atomic(source, info):\n \"Parses an atomic subpattern.\"\n saved_flags = info.flags\n try:\n subpattern = _parse_pattern(source, info)\n source.expect(\")\")\n finally:\n info.flags = saved_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L896_C4", "label": "expression", "type": "expression", "loc": [896, 896], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L895_C0", "vector": [8, 1, 0.2172, 0.0002, 1, 0.02, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses an atomic subpattern.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L897_C4", "label": "saved_flags =", "type": "assigned_variable", "loc": [897, 897], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L895_C0", "vector": [14, 1, 0.2175, 0.0002, 1, 0.02, 0.3333, 840, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_flags = info.flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L898_C4", "label": "try", "type": "try", "loc": [898, 903], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L895_C0", "vector": [7, 1, 0.2183, 0.0015, 1, 0.02, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n subpattern = _parse_pattern(source, info)\n source.expect(\")\")\n finally:\n info.flags = saved_flags\n source.ignore_space = bool(info.flags & VERBOSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L899_C8", "label": "subpattern = _parse_pattern()", "type": "assigned_variable", "loc": [899, 899], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L898_C4", "vector": [14, 2, 0.2179, 0.0002, 2, 0.35, 0.0, 276, 3, 2, 0, 0, 68, 10, 1], "semantic": {"name": "subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "_parse_pattern", "annotation": ""}, "snippet": " subpattern = _parse_pattern(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L900_C8", "label": "expect()", "type": "expression", "loc": [900, 900], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L898_C4", "vector": [8, 2, 0.2182, 0.0002, 2, 0.35, 0.3333, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L902_C8", "label": "info.flags =", "type": "assigned_variable", "loc": [902, 902], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L898_C4", "vector": [14, 2, 0.2187, 0.0002, 2, 0.35, 0.6667, 121, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "info.flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " info.flags = saved_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L903_C8", "label": "source.ignore_space = bool()", "type": "assigned_variable", "loc": [903, 903], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L898_C4", "vector": [14, 2, 0.2189, 0.0002, 2, 0.35, 1.0, 890, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "source.ignore_space", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " source.ignore_space = bool(info.flags & VERBOSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L905_C4", "label": "return", "type": "return", "loc": [905, 905], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L895_C0", "vector": [13, 1, 0.2194, 0.0002, 1, 0.02, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Atomic(subpattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L907_C0", "label": "parse_common", "type": "function", "loc": [907, 923], "level": 0, "parent": null, "vector": [2, 0, 0.2218, 0.0041, 0, 0.66, 0.4663, 107, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "parse_common", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_common(source, info):\n \"Parses a common groups branch.\"\n # Capture group numbers in different branches can reuse the group numbers.\n initial_group_count = info.group_count\n branches = [parse_sequence(source, info)]\n final_group_count = info.group_count\n while source.match(\"|\"):\n info.group_count = initial_group_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L908_C4", "label": "expression", "type": "expression", "loc": [908, 908], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L907_C0", "vector": [8, 1, 0.2201, 0.0002, 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 common groups branch.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L910_C4", "label": "initial_group_count =", "type": "assigned_variable", "loc": [910, 910], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L907_C0", "vector": [14, 1, 0.2206, 0.0002, 1, 0.19, 0.125, 5, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "initial_group_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " initial_group_count = info.group_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L911_C4", "label": "branches =", "type": "assigned_variable", "loc": [911, 911], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L907_C0", "vector": [14, 1, 0.2208, 0.0002, 1, 0.19, 0.25, 286, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "branches", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " branches = [parse_sequence(source, info)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L912_C4", "label": "final_group_count =", "type": "assigned_variable", "loc": [912, 912], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L907_C0", "vector": [14, 1, 0.2211, 0.0002, 1, 0.19, 0.375, 809, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "final_group_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " final_group_count = info.group_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L913_C4", "label": "while", "type": "while", "loc": [913, 916], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L907_C0", "vector": [5, 1, 0.2217, 0.001, 1, 0.19, 0.5, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while source.match(\"|\"):\n info.group_count = initial_group_count\n branches.append(parse_sequence(source, info))\n final_group_count = max(final_group_count, info.group_count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L914_C8", "label": "info.group_count =", "type": "assigned_variable", "loc": [914, 914], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L913_C4", "vector": [14, 2, 0.2216, 0.0002, 2, 0.0, 0.0, 766, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "info.group_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " info.group_count = initial_group_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L915_C8", "label": "append()", "type": "expression", "loc": [915, 915], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L913_C4", "vector": [8, 2, 0.2218, 0.0002, 2, 0.0, 0.5, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " branches.append(parse_sequence(source, info))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L916_C8", "label": "final_group_count = max()", "type": "assigned_variable", "loc": [916, 916], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L913_C4", "vector": [14, 2, 0.2221, 0.0002, 2, 0.0, 1.0, 809, 3, 2, 0, 0, 442, 10, 1], "semantic": {"name": "final_group_count", "arg_names": [], "import_names": [], "rhs_call_name": "max", "annotation": ""}, "snippet": " final_group_count = max(final_group_count, info.group_count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L918_C4", "label": "info.group_count =", "type": "assigned_variable", "loc": [918, 918], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L907_C0", "vector": [14, 1, 0.2225, 0.0002, 1, 0.19, 0.625, 766, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "info.group_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " info.group_count = final_group_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L919_C4", "label": "expect()", "type": "expression", "loc": [919, 919], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L907_C0", "vector": [8, 1, 0.2228, 0.0002, 1, 0.19, 0.75, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L921_C4", "label": "if", "type": "if", "loc": [921, 922], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L907_C0", "vector": [4, 1, 0.2234, 0.0005, 1, 0.19, 0.875, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(branches) == 1:\n return branches[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L922_C8", "label": "return", "type": "return", "loc": [922, 922], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L921_C4", "vector": [13, 2, 0.2235, 0.0002, 2, 0.78, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return branches[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L923_C4", "label": "return", "type": "return", "loc": [923, 923], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L907_C0", "vector": [13, 1, 0.2238, 0.0002, 1, 0.19, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Branch(branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L925_C0", "label": "parse_call_group", "type": "function", "loc": [925, 934], "level": 0, "parent": null, "vector": [2, 0, 0.2253, 0.0024, 0, 0.66, 0.4715, 988, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "parse_call_group", "arg_names": ["source", "info", "ch", "pos"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_call_group(source, info, ch, pos):\n \"Parses a call to a group.\"\n if ch == \"R\":\n group = \"0\"\n else:\n group = ch + source.get_while(DIGITS)\n\n source.expect(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L926_C4", "label": "expression", "type": "expression", "loc": [926, 926], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L925_C0", "vector": [8, 1, 0.2245, 0.0002, 1, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a call to a group.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L927_C4", "label": "if", "type": "if", "loc": [927, 930], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L925_C0", "vector": [4, 1, 0.2251, 0.001, 1, 0.88, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"R\":\n group = \"0\"\n else:\n group = ch + source.get_while(DIGITS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L928_C8", "label": "group =", "type": "assigned_variable", "loc": [928, 928], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L927_C4", "vector": [14, 2, 0.225, 0.0002, 2, 0.05, 0.0, 43, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " group = \"0\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L930_C8", "label": "group =", "type": "assigned_variable", "loc": [930, 930], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L927_C4", "vector": [14, 2, 0.2255, 0.0002, 2, 0.05, 1.0, 43, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " group = ch + source.get_while(DIGITS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L932_C4", "label": "expect()", "type": "expression", "loc": [932, 932], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L925_C0", "vector": [8, 1, 0.2259, 0.0002, 1, 0.88, 0.6667, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L934_C4", "label": "return", "type": "return", "loc": [934, 934], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L925_C0", "vector": [13, 1, 0.2264, 0.0002, 1, 0.88, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return CallGroup(info, group, pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L936_C0", "label": "parse_call_named_group", "type": "function", "loc": [936, 941], "level": 0, "parent": null, "vector": [2, 0, 0.2275, 0.0015, 0, 0.66, 0.4767, 450, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "parse_call_named_group", "arg_names": ["source", "info", "pos"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_call_named_group(source, info, pos):\n \"Parses a call to a named group.\"\n group = parse_name(source)\n source.expect(\")\")\n\n return CallGroup(info, group, pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L937_C4", "label": "expression", "type": "expression", "loc": [937, 937], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L936_C0", "vector": [8, 1, 0.2272, 0.0002, 1, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a call to a named group.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L938_C4", "label": "group = parse_name()", "type": "assigned_variable", "loc": [938, 938], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L936_C0", "vector": [14, 1, 0.2274, 0.0002, 1, 0.84, 0.3333, 43, 3, 1, 0, 0, 382, 10, 1], "semantic": {"name": "group", "arg_names": [], "import_names": [], "rhs_call_name": "parse_name", "annotation": ""}, "snippet": " group = parse_name(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L939_C4", "label": "expect()", "type": "expression", "loc": [939, 939], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L936_C0", "vector": [8, 1, 0.2276, 0.0002, 1, 0.84, 0.6667, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L941_C4", "label": "return", "type": "return", "loc": [941, 941], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L936_C0", "vector": [13, 1, 0.2281, 0.0002, 1, 0.84, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return CallGroup(info, group, pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L943_C0", "label": "parse_flag_set", "type": "function", "loc": [943, 957], "level": 0, "parent": null, "vector": [2, 0, 0.2303, 0.0036, 0, 0.66, 0.4819, 121, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "parse_flag_set", "arg_names": ["source"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_flag_set(source):\n \"Parses a set of inline flags.\"\n flags = 0\n\n try:\n while True:\n saved_pos = source.pos\n ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L944_C4", "label": "expression", "type": "expression", "loc": [944, 944], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L943_C0", "vector": [8, 1, 0.2288, 0.0002, 1, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a set of inline flags.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L945_C4", "label": "flags =", "type": "assigned_variable", "loc": [945, 945], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L943_C0", "vector": [14, 1, 0.2291, 0.0002, 1, 0.38, 0.3333, 375, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " flags = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L947_C4", "label": "try", "type": "try", "loc": [947, 955], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L943_C0", "vector": [7, 1, 0.2305, 0.0022, 1, 0.38, 0.6667, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n while True:\n saved_pos = source.pos\n ch = source.get()\n if ch == \"V\":\n ch += source.get()\n flags |= REGEX_FLAGS[ch]\n except KeyError:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L948_C8", "label": "while", "type": "while", "loc": [948, 953], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L947_C4", "vector": [5, 2, 0.2304, 0.0015, 2, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n saved_pos = source.pos\n ch = source.get()\n if ch == \"V\":\n ch += source.get()\n flags |= REGEX_FLAGS[ch]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L949_C12", "label": "saved_pos =", "type": "assigned_variable", "loc": [949, 949], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L948_C8", "vector": [14, 3, 0.2301, 0.0002, 3, 0.19, 0.0, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L950_C12", "label": "ch = get()", "type": "assigned_variable", "loc": [950, 950], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L948_C8", "vector": [14, 3, 0.2303, 0.0002, 3, 0.19, 0.5, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L951_C12", "label": "if", "type": "if", "loc": [951, 952], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L948_C8", "vector": [4, 3, 0.2307, 0.0005, 3, 0.19, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"V\":\n ch += source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L955_C8", "label": "source.pos =", "type": "assigned_variable", "loc": [955, 955], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L947_C4", "vector": [14, 2, 0.2315, 0.0002, 2, 0.81, 0.0, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L957_C4", "label": "return", "type": "return", "loc": [957, 957], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L943_C0", "vector": [13, 1, 0.232, 0.0002, 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 flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L959_C0", "label": "parse_flags", "type": "function", "loc": [959, 974], "level": 0, "parent": null, "vector": [2, 0, 0.2343, 0.0039, 0, 0.66, 0.487, 988, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "parse_flags", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_flags(source, info):\n \"Parses flags being turned on/off.\"\n flags_on = parse_flag_set(source)\n if source.match(\"-\"):\n flags_off = parse_flag_set(source)\n if not flags_off:\n raise error(\"bad inline flags: no flags after '-'\", source.string,\n source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L960_C4", "label": "expression", "type": "expression", "loc": [960, 960], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L959_C0", "vector": [8, 1, 0.2327, 0.0002, 1, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses flags being turned on/off.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L961_C4", "label": "flags_on = parse_flag_set()", "type": "assigned_variable", "loc": [961, 961], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L959_C0", "vector": [14, 1, 0.233, 0.0002, 1, 0.88, 0.25, 79, 3, 1, 0, 0, 121, 10, 1], "semantic": {"name": "flags_on", "arg_names": [], "import_names": [], "rhs_call_name": "parse_flag_set", "annotation": ""}, "snippet": " flags_on = parse_flag_set(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L962_C4", "label": "if", "type": "if", "loc": [962, 968], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L959_C0", "vector": [4, 1, 0.2339, 0.0017, 1, 0.88, 0.5, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source.match(\"-\"):\n flags_off = parse_flag_set(source)\n if not flags_off:\n raise error(\"bad inline flags: no flags after '-'\", source.string,\n source.pos)\n else:\n flags_off = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L963_C8", "label": "flags_off = parse_flag_set()", "type": "assigned_variable", "loc": [963, 963], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L962_C4", "vector": [14, 2, 0.2335, 0.0002, 2, 0.9, 0.0, 576, 3, 1, 0, 0, 121, 10, 1], "semantic": {"name": "flags_off", "arg_names": [], "import_names": [], "rhs_call_name": "parse_flag_set", "annotation": ""}, "snippet": " flags_off = parse_flag_set(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L964_C8", "label": "if", "type": "if", "loc": [964, 966], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L962_C4", "vector": [4, 2, 0.2339, 0.0007, 2, 0.9, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not flags_off:\n raise error(\"bad inline flags: no flags after '-'\", source.string,\n source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L968_C8", "label": "flags_off =", "type": "assigned_variable", "loc": [968, 968], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L962_C4", "vector": [14, 2, 0.2347, 0.0002, 2, 0.9, 1.0, 576, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "flags_off", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " flags_off = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L970_C4", "label": "if", "type": "if", "loc": [970, 972], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L959_C0", "vector": [4, 1, 0.2354, 0.0007, 1, 0.88, 0.75, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if flags_on & LOCALE:\n # Remember that this pattern as an inline locale flag.\n info.inline_locale = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L972_C8", "label": "info.inline_locale =", "type": "assigned_variable", "loc": [972, 972], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L970_C4", "vector": [14, 2, 0.2356, 0.0002, 2, 0.99, 0.0, 704, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "info.inline_locale", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " info.inline_locale = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L974_C4", "label": "return", "type": "return", "loc": [974, 974], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L959_C0", "vector": [13, 1, 0.2361, 0.0002, 1, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return flags_on, flags_off"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L976_C0", "label": "parse_subpattern", "type": "function", "loc": [976, 988], "level": 0, "parent": null, "vector": [2, 0, 0.2381, 0.0032, 0, 0.66, 0.4922, 410, 0, 4, 1, 0, 0, 0, 4], "semantic": {"name": "parse_subpattern", "arg_names": ["source", "info", "flags_on", "flags_off"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_subpattern(source, info, flags_on, flags_off):\n \"Parses a subpattern with scoped flags.\"\n saved_flags = info.flags\n info.flags = (info.flags | flags_on) & ~flags_off\n source.ignore_space = bool(info.flags & VERBOSE)\n try:\n subpattern = _parse_pattern(source, info)\n source.expect(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L977_C4", "label": "expression", "type": "expression", "loc": [977, 977], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L976_C0", "vector": [8, 1, 0.2368, 0.0002, 1, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a subpattern with scoped flags.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L978_C4", "label": "saved_flags =", "type": "assigned_variable", "loc": [978, 978], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L976_C0", "vector": [14, 1, 0.2371, 0.0002, 1, 0.35, 0.2, 840, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_flags = info.flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L979_C4", "label": "info.flags =", "type": "assigned_variable", "loc": [979, 979], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L976_C0", "vector": [14, 1, 0.2373, 0.0002, 1, 0.35, 0.4, 121, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "info.flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " info.flags = (info.flags | flags_on) & ~flags_off"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L980_C4", "label": "source.ignore_space = bool()", "type": "assigned_variable", "loc": [980, 980], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L976_C0", "vector": [14, 1, 0.2376, 0.0002, 1, 0.35, 0.6, 890, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "source.ignore_space", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " source.ignore_space = bool(info.flags & VERBOSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L981_C4", "label": "try", "type": "try", "loc": [981, 986], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L976_C0", "vector": [7, 1, 0.2384, 0.0015, 1, 0.35, 0.8, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n subpattern = _parse_pattern(source, info)\n source.expect(\")\")\n finally:\n info.flags = saved_flags\n source.ignore_space = bool(info.flags & VERBOSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L982_C8", "label": "subpattern = _parse_pattern()", "type": "assigned_variable", "loc": [982, 982], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L981_C4", "vector": [14, 2, 0.2381, 0.0002, 2, 0.48, 0.0, 276, 3, 2, 0, 0, 68, 10, 1], "semantic": {"name": "subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "_parse_pattern", "annotation": ""}, "snippet": " subpattern = _parse_pattern(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L983_C8", "label": "expect()", "type": "expression", "loc": [983, 983], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L981_C4", "vector": [8, 2, 0.2383, 0.0002, 2, 0.48, 0.3333, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L985_C8", "label": "info.flags =", "type": "assigned_variable", "loc": [985, 985], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L981_C4", "vector": [14, 2, 0.2388, 0.0002, 2, 0.48, 0.6667, 121, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "info.flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " info.flags = saved_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L986_C8", "label": "source.ignore_space = bool()", "type": "assigned_variable", "loc": [986, 986], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L981_C4", "vector": [14, 2, 0.239, 0.0002, 2, 0.48, 1.0, 890, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "source.ignore_space", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " source.ignore_space = bool(info.flags & VERBOSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L988_C4", "label": "return", "type": "return", "loc": [988, 988], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L976_C0", "vector": [13, 1, 0.2395, 0.0002, 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 subpattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L990_C0", "label": "parse_flags_subpattern", "type": "function", "loc": [990, 1023], "level": 0, "parent": null, "vector": [2, 0, 0.244, 0.0082, 0, 0.66, 0.4974, 879, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "parse_flags_subpattern", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_flags_subpattern(source, info):\n \"\"\"Parses a flags subpattern. It could be inline flags or a subpattern\n possibly with local flags. If it's a subpattern, then that's returned;\n if it's a inline flags, then FLAGS is returned.\n \"\"\"\n flags_on, flags_off = parse_flags(source, info)\n\n if flags_off & GLOBAL_FLAGS:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L991_C4", "label": "expression", "type": "expression", "loc": [991, 994], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L990_C0", "vector": [8, 1, 0.2406, 0.001, 1, 0.9, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Parses a flags subpattern. It could be inline flags or a subpattern\n possibly with local flags. If it's a subpattern, then that's returned;\n if it's a inline flags, then FLAGS is returned.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L995_C4", "label": "flags_on, flags_off = parse_flags()", "type": "assigned_variable", "loc": [995, 995], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L990_C0", "vector": [14, 1, 0.2412, 0.0002, 1, 0.9, 0.1429, 936, 3, 2, 0, 0, 988, 10, 1], "semantic": {"name": "flags_on, flags_off", "arg_names": [], "import_names": [], "rhs_call_name": "parse_flags", "annotation": ""}, "snippet": " flags_on, flags_off = parse_flags(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L997_C4", "label": "if", "type": "if", "loc": [997, 999], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L990_C0", "vector": [4, 1, 0.2419, 0.0007, 1, 0.9, 0.2857, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if flags_off & GLOBAL_FLAGS:\n raise error(\"bad inline flags: cannot turn off global flag\",\n source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1001_C4", "label": "if", "type": "if", "loc": [1001, 1003], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L990_C0", "vector": [4, 1, 0.2429, 0.0007, 1, 0.9, 0.4286, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if flags_on & flags_off:\n raise error(\"bad inline flags: flag turned on and off\", source.string,\n source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1006_C4", "label": "new_global_flags =", "type": "assigned_variable", "loc": [1006, 1006], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L990_C0", "vector": [14, 1, 0.2439, 0.0002, 1, 0.9, 0.5714, 765, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_global_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_global_flags = (flags_on & ~info.global_flags) & GLOBAL_FLAGS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1007_C4", "label": "if", "type": "if", "loc": [1007, 1011], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L990_C0", "vector": [4, 1, 0.2446, 0.0012, 1, 0.9, 0.7143, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if new_global_flags:\n info.global_flags |= new_global_flags\n\n # A global has been turned on, so reparse the pattern.\n raise _UnscopedFlagSet(info.global_flags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1016_C4", "label": "if", "type": "if", "loc": [1016, 1017], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L990_C0", "vector": [4, 1, 0.2464, 0.0005, 1, 0.9, 0.8571, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source.match(\":\"):\n return parse_subpattern(source, info, flags_on, flags_off)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1017_C8", "label": "return", "type": "return", "loc": [1017, 1017], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1016_C4", "vector": [13, 2, 0.2465, 0.0002, 2, 0.96, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_subpattern(source, info, flags_on, flags_off)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1019_C4", "label": "if", "type": "if", "loc": [1019, 1021], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L990_C0", "vector": [4, 1, 0.2473, 0.0007, 1, 0.9, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source.match(\")\"):\n parse_positional_flags(source, info, flags_on, flags_off)\n return FLAGS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1020_C8", "label": "parse_positional_flags()", "type": "expression", "loc": [1020, 1020], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1019_C4", "vector": [8, 2, 0.2473, 0.0002, 2, 0.15, 0.0, 257, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "parse_positional_flags", "arg_names": [], "import_names": [], "rhs_call_name": "parse_positional_flags", "annotation": ""}, "snippet": " parse_positional_flags(source, info, flags_on, flags_off)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1021_C8", "label": "return", "type": "return", "loc": [1021, 1021], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1019_C4", "vector": [13, 2, 0.2475, 0.0002, 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 FLAGS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1025_C0", "label": "parse_positional_flags", "type": "function", "loc": [1025, 1043], "level": 0, "parent": null, "vector": [2, 0, 0.2507, 0.0046, 0, 0.66, 0.5026, 257, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "parse_positional_flags", "arg_names": ["source", "info", "flags_on", "flags_off"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_positional_flags(source, info, flags_on, flags_off):\n \"Parses positional flags.\"\n version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION\n if version == VERSION0:\n # Positional flags are global and can only be turned on.\n if flags_off:\n raise error(\"bad inline flags: cannot turn flags off\",\n source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1026_C4", "label": "expression", "type": "expression", "loc": [1026, 1026], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1025_C0", "vector": [8, 1, 0.2487, 0.0002, 1, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses positional flags.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1027_C4", "label": "version =", "type": "assigned_variable", "loc": [1027, 1027], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1025_C0", "vector": [14, 1, 0.249, 0.0002, 1, 0.16, 0.3333, 623, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1028_C4", "label": "if", "type": "if", "loc": [1028, 1041], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1025_C0", "vector": [4, 1, 0.2508, 0.0034, 1, 0.16, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version == VERSION0:\n # Positional flags are global and can only be turned on.\n if flags_off:\n raise error(\"bad inline flags: cannot turn flags off\",\n source.string, source.pos)\n\n new_global_flags = flags_on & ~info.global_flags\n if new_global_flags:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1030_C8", "label": "if", "type": "if", "loc": [1030, 1032], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1028_C4", "vector": [4, 2, 0.2499, 0.0007, 2, 0.73, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if flags_off:\n raise error(\"bad inline flags: cannot turn flags off\",\n source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1034_C8", "label": "new_global_flags =", "type": "assigned_variable", "loc": [1034, 1034], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1028_C4", "vector": [14, 2, 0.2507, 0.0002, 2, 0.73, 0.3333, 765, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_global_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_global_flags = flags_on & ~info.global_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1035_C8", "label": "if", "type": "if", "loc": [1035, 1039], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1028_C4", "vector": [4, 2, 0.2514, 0.0012, 2, 0.73, 0.6667, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if new_global_flags:\n info.global_flags |= new_global_flags\n\n # A global has been turned on, so reparse the pattern.\n raise _UnscopedFlagSet(info.global_flags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1041_C8", "label": "info.flags =", "type": "assigned_variable", "loc": [1041, 1041], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1028_C4", "vector": [14, 2, 0.2524, 0.0002, 2, 0.73, 1.0, 121, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "info.flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " info.flags = (info.flags | flags_on) & ~flags_off"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1043_C4", "label": "source.ignore_space = bool()", "type": "assigned_variable", "loc": [1043, 1043], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1025_C0", "vector": [14, 1, 0.2528, 0.0002, 1, 0.16, 1.0, 890, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "source.ignore_space", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " source.ignore_space = bool(info.flags & VERBOSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1045_C0", "label": "parse_name", "type": "function", "loc": [1045, 1060], "level": 0, "parent": null, "vector": [2, 0, 0.2552, 0.0039, 0, 0.66, 0.5078, 382, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "parse_name", "arg_names": ["source", "allow_numeric", "allow_group_0"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_name(source, allow_numeric=False, allow_group_0=False):\n \"Parses a name.\"\n name = source.get_while(set(\")>\"), include=False)\n\n if not name:\n raise error(\"bad group name\", source.string, source.pos)\n\n if name.isdigit():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1046_C4", "label": "expression", "type": "expression", "loc": [1046, 1046], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1045_C0", "vector": [8, 1, 0.2536, 0.0002, 1, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a name.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1047_C4", "label": "name = get_while()", "type": "assigned_variable", "loc": [1047, 1047], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1045_C0", "vector": [14, 1, 0.2538, 0.0002, 1, 0.49, 0.25, 57, 3, 2, 0, 0, 729, 10, 2], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "get_while", "annotation": ""}, "snippet": " name = source.get_while(set(\")>\"), include=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1049_C4", "label": "if", "type": "if", "loc": [1049, 1050], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1045_C0", "vector": [4, 1, 0.2544, 0.0005, 1, 0.49, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not name:\n raise error(\"bad group name\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1052_C4", "label": "if", "type": "if", "loc": [1052, 1058], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1045_C0", "vector": [4, 1, 0.2558, 0.0017, 1, 0.49, 0.75, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name.isdigit():\n min_group = 0 if allow_group_0 else 1\n if not allow_numeric or int(name) < min_group:\n raise error(\"bad group name\", source.string, source.pos)\n else:\n if not name.isidentifier():\n raise error(\"bad group name\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1053_C8", "label": "min_group =", "type": "assigned_variable", "loc": [1053, 1053], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1052_C4", "vector": [14, 2, 0.2553, 0.0002, 2, 0.94, 0.0, 223, 8, 0, 0, 0, 0, 0, 0], "semantic": {"name": "min_group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " min_group = 0 if allow_group_0 else 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1054_C8", "label": "if", "type": "if", "loc": [1054, 1055], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1052_C4", "vector": [4, 2, 0.2556, 0.0005, 2, 0.94, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not allow_numeric or int(name) < min_group:\n raise error(\"bad group name\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1057_C8", "label": "if", "type": "if", "loc": [1057, 1058], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1052_C4", "vector": [4, 2, 0.2564, 0.0005, 2, 0.94, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not name.isidentifier():\n raise error(\"bad group name\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1060_C4", "label": "return", "type": "return", "loc": [1060, 1060], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1045_C0", "vector": [13, 1, 0.257, 0.0002, 1, 0.49, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1062_C0", "label": "is_octal", "type": "function", "loc": [1062, 1064], "level": 0, "parent": null, "vector": [2, 0, 0.2577, 0.0007, 0, 0.66, 0.513, 45, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "is_octal", "arg_names": ["string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_octal(string):\n \"Checks whether a string is octal.\"\n return all(ch in OCT_DIGITS for ch in string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1063_C4", "label": "expression", "type": "expression", "loc": [1063, 1063], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1062_C0", "vector": [8, 1, 0.2577, 0.0002, 1, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Checks whether a string is octal.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1064_C4", "label": "return", "type": "return", "loc": [1064, 1064], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1062_C0", "vector": [13, 1, 0.2579, 0.0002, 1, 0.28, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return all(ch in OCT_DIGITS for ch in string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1066_C0", "label": "is_decimal", "type": "function", "loc": [1066, 1068], "level": 0, "parent": null, "vector": [2, 0, 0.2587, 0.0007, 0, 0.66, 0.5181, 23, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "is_decimal", "arg_names": ["string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_decimal(string):\n \"Checks whether a string is decimal.\"\n return all(ch in DIGITS for ch in string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1067_C4", "label": "expression", "type": "expression", "loc": [1067, 1067], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1066_C0", "vector": [8, 1, 0.2587, 0.0002, 1, 0.42, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Checks whether a string is decimal.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1068_C4", "label": "return", "type": "return", "loc": [1068, 1068], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1066_C0", "vector": [13, 1, 0.2589, 0.0002, 1, 0.42, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return all(ch in DIGITS for ch in string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1070_C0", "label": "is_hexadecimal", "type": "function", "loc": [1070, 1072], "level": 0, "parent": null, "vector": [2, 0, 0.2596, 0.0007, 0, 0.66, 0.5233, 618, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "is_hexadecimal", "arg_names": ["string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_hexadecimal(string):\n \"Checks whether a string is hexadecimal.\"\n return all(ch in HEX_DIGITS for ch in string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1071_C4", "label": "expression", "type": "expression", "loc": [1071, 1071], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1070_C0", "vector": [8, 1, 0.2596, 0.0002, 1, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Checks whether a string is hexadecimal.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1072_C4", "label": "return", "type": "return", "loc": [1072, 1072], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1070_C0", "vector": [13, 1, 0.2599, 0.0002, 1, 0.7, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return all(ch in HEX_DIGITS for ch in string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1074_C0", "label": "parse_escape", "type": "function", "loc": [1074, 1137], "level": 0, "parent": null, "vector": [2, 0, 0.268, 0.0155, 0, 0.66, 0.5285, 66, 0, 3, 1, 0, 0, 0, 22], "semantic": {"name": "parse_escape", "arg_names": ["source", "info", "in_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_escape(source, info, in_set):\n \"Parses an escape sequence.\"\n saved_ignore = source.ignore_space\n source.ignore_space = False\n ch = source.get()\n source.ignore_space = saved_ignore\n if not ch:\n # A backslash at the end of the pattern."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1075_C4", "label": "expression", "type": "expression", "loc": [1075, 1075], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1074_C0", "vector": [8, 1, 0.2606, 0.0002, 1, 0.89, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses an escape sequence.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1076_C4", "label": "saved_ignore =", "type": "assigned_variable", "loc": [1076, 1076], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1074_C0", "vector": [14, 1, 0.2608, 0.0002, 1, 0.89, 0.1667, 687, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_ignore", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_ignore = source.ignore_space"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1077_C4", "label": "source.ignore_space =", "type": "assigned_variable", "loc": [1077, 1077], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1074_C0", "vector": [14, 1, 0.2611, 0.0002, 1, 0.89, 0.3333, 890, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "source.ignore_space", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.ignore_space = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1078_C4", "label": "ch = get()", "type": "assigned_variable", "loc": [1078, 1078], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1074_C0", "vector": [14, 1, 0.2613, 0.0002, 1, 0.89, 0.5, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1079_C4", "label": "source.ignore_space =", "type": "assigned_variable", "loc": [1079, 1079], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1074_C0", "vector": [14, 1, 0.2616, 0.0002, 1, 0.89, 0.6667, 890, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.ignore_space", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.ignore_space = saved_ignore"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1080_C4", "label": "if", "type": "if", "loc": [1080, 1082], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1074_C0", "vector": [4, 1, 0.2621, 0.0007, 1, 0.89, 0.8333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not ch:\n # A backslash at the end of the pattern.\n raise error(\"bad escape\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1083_C4", "label": "if", "type": "if", "loc": [1083, 1137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1074_C0", "vector": [4, 1, 0.2691, 0.0133, 1, 0.89, 1.0, 0, 0, 0, 0, 0, 0, 0, 20], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch in HEX_ESCAPES:\n # A hexadecimal escape sequence.\n return parse_hex_escape(source, info, HEX_ESCAPES[ch], in_set)\n elif ch == \"g\" and not in_set:\n # A group reference.\n saved_pos = source.pos\n try:\n return parse_group_ref(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1085_C8", "label": "return", "type": "return", "loc": [1085, 1085], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1083_C4", "vector": [13, 2, 0.263, 0.0002, 2, 0.94, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_hex_escape(source, info, HEX_ESCAPES[ch], in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1086_C4", "label": "if", "type": "if", "loc": [1086, 1137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1083_C4", "vector": [4, 2, 0.2695, 0.0126, 2, 0.94, 1.0, 0, 0, 0, 0, 0, 0, 0, 19], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ch == \"g\" and not in_set:\n # A group reference.\n saved_pos = source.pos\n try:\n return parse_group_ref(source, info)\n except error:\n # Invalid as a group reference, so assume it's a literal.\n source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1088_C8", "label": "saved_pos =", "type": "assigned_variable", "loc": [1088, 1088], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1086_C4", "vector": [14, 3, 0.2638, 0.0002, 3, 0.68, 0.0, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1089_C8", "label": "try", "type": "try", "loc": [1089, 1093], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1086_C4", "vector": [7, 3, 0.2645, 0.0012, 3, 0.68, 0.3333, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return parse_group_ref(source, info)\n except error:\n # Invalid as a group reference, so assume it's a literal.\n source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1090_C12", "label": "return", "type": "return", "loc": [1090, 1090], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1089_C8", "vector": [13, 4, 0.2642, 0.0002, 4, 0.34, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_group_ref(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1093_C12", "label": "source.pos =", "type": "assigned_variable", "loc": [1093, 1093], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1089_C8", "vector": [14, 4, 0.265, 0.0002, 4, 0.34, 0.0, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1095_C8", "label": "return", "type": "return", "loc": [1095, 1095], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1086_C4", "vector": [13, 3, 0.2655, 0.0002, 3, 0.68, 0.6667, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return make_character(info, ord(ch), in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1096_C4", "label": "if", "type": "if", "loc": [1096, 1137], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1086_C4", "vector": [4, 3, 0.2707, 0.0102, 3, 0.68, 1.0, 0, 0, 0, 0, 0, 0, 0, 16], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ch == \"G\" and not in_set:\n # A search anchor.\n return SearchAnchor()\n elif ch == \"L\" and not in_set:\n # A string set.\n return parse_string_set(source, info)\n elif ch == \"N\":\n # A named codepoint."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1098_C8", "label": "return", "type": "return", "loc": [1098, 1098], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1096_C4", "vector": [13, 4, 0.2662, 0.0002, 4, 0.93, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return SearchAnchor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1099_C4", "label": "if", "type": "if", "loc": [1099, 1137], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1096_C4", "vector": [4, 4, 0.271, 0.0095, 4, 0.93, 1.0, 0, 0, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ch == \"L\" and not in_set:\n # A string set.\n return parse_string_set(source, info)\n elif ch == \"N\":\n # A named codepoint.\n return parse_named_char(source, info, in_set)\n elif ch in \"pP\":\n # A Unicode property, positive or negative."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1101_C8", "label": "return", "type": "return", "loc": [1101, 1101], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1099_C4", "vector": [13, 5, 0.2669, 0.0002, 5, 0.48, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_string_set(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1102_C4", "label": "if", "type": "if", "loc": [1102, 1137], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1099_C4", "vector": [4, 5, 0.2714, 0.0087, 5, 0.48, 1.0, 0, 0, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ch == \"N\":\n # A named codepoint.\n return parse_named_char(source, info, in_set)\n elif ch in \"pP\":\n # A Unicode property, positive or negative.\n return parse_property(source, info, ch == \"p\", in_set)\n elif ch == \"X\" and not in_set:\n # A grapheme cluster."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1104_C8", "label": "return", "type": "return", "loc": [1104, 1104], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1102_C4", "vector": [13, 6, 0.2676, 0.0002, 6, 0.17, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_named_char(source, info, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1105_C4", "label": "if", "type": "if", "loc": [1105, 1137], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1102_C4", "vector": [4, 6, 0.2718, 0.008, 6, 0.17, 1.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ch in \"pP\":\n # A Unicode property, positive or negative.\n return parse_property(source, info, ch == \"p\", in_set)\n elif ch == \"X\" and not in_set:\n # A grapheme cluster.\n return Grapheme()\n elif ch in ALPHA:\n # An alphabetic escape sequence."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1107_C8", "label": "return", "type": "return", "loc": [1107, 1107], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1105_C4", "vector": [13, 7, 0.2684, 0.0002, 7, 0.1, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_property(source, info, ch == \"p\", in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1108_C4", "label": "if", "type": "if", "loc": [1108, 1137], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1105_C4", "vector": [4, 7, 0.2721, 0.0073, 7, 0.1, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ch == \"X\" and not in_set:\n # A grapheme cluster.\n return Grapheme()\n elif ch in ALPHA:\n # An alphabetic escape sequence.\n # Positional escapes aren't allowed inside a character set.\n if not in_set:\n if info.flags & WORD:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1110_C8", "label": "return", "type": "return", "loc": [1110, 1110], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1108_C4", "vector": [13, 8, 0.2691, 0.0002, 8, 0.27, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Grapheme()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1111_C4", "label": "if", "type": "if", "loc": [1111, 1137], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1108_C4", "vector": [4, 8, 0.2725, 0.0065, 8, 0.27, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ch in ALPHA:\n # An alphabetic escape sequence.\n # Positional escapes aren't allowed inside a character set.\n if not in_set:\n if info.flags & WORD:\n value = WORD_POSITION_ESCAPES.get(ch)\n else:\n value = POSITION_ESCAPES.get(ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1114_C8", "label": "if", "type": "if", "loc": [1114, 1121], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1111_C4", "vector": [4, 9, 0.2709, 0.0019, 9, 0.19, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not in_set:\n if info.flags & WORD:\n value = WORD_POSITION_ESCAPES.get(ch)\n else:\n value = POSITION_ESCAPES.get(ch)\n\n if value:\n return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1115_C12", "label": "if", "type": "if", "loc": [1115, 1118], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1114_C8", "vector": [4, 10, 0.2707, 0.001, 10, 0.89, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if info.flags & WORD:\n value = WORD_POSITION_ESCAPES.get(ch)\n else:\n value = POSITION_ESCAPES.get(ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1116_C16", "label": "value = get()", "type": "assigned_variable", "loc": [1116, 1116], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1115_C12", "vector": [14, 11, 0.2705, 0.0002, 11, 0.72, 0.0, 441, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " value = WORD_POSITION_ESCAPES.get(ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1118_C16", "label": "value = get()", "type": "assigned_variable", "loc": [1118, 1118], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1115_C12", "vector": [14, 11, 0.271, 0.0002, 11, 0.72, 1.0, 441, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " value = POSITION_ESCAPES.get(ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1120_C12", "label": "if", "type": "if", "loc": [1120, 1121], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1114_C8", "vector": [4, 10, 0.2716, 0.0005, 10, 0.89, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value:\n return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1121_C16", "label": "return", "type": "return", "loc": [1121, 1121], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1120_C12", "vector": [13, 11, 0.2718, 0.0002, 11, 0.59, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1123_C8", "label": "value = get()", "type": "assigned_variable", "loc": [1123, 1123], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1111_C4", "vector": [14, 9, 0.2722, 0.0002, 9, 0.19, 0.1667, 441, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " value = CHARSET_ESCAPES.get(ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1124_C8", "label": "if", "type": "if", "loc": [1124, 1125], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1111_C4", "vector": [4, 9, 0.2726, 0.0005, 9, 0.19, 0.3333, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value:\n return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1125_C12", "label": "return", "type": "return", "loc": [1125, 1125], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1124_C8", "vector": [13, 10, 0.2727, 0.0002, 10, 0.55, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1127_C8", "label": "value = get()", "type": "assigned_variable", "loc": [1127, 1127], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1111_C4", "vector": [14, 9, 0.2732, 0.0002, 9, 0.19, 0.5, 441, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " value = CHARACTER_ESCAPES.get(ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1128_C8", "label": "if", "type": "if", "loc": [1128, 1129], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1111_C4", "vector": [4, 9, 0.2736, 0.0005, 9, 0.19, 0.6667, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value:\n return Character(ord(value))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1129_C12", "label": "return", "type": "return", "loc": [1129, 1129], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1128_C8", "vector": [13, 10, 0.2737, 0.0002, 10, 0.83, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Character(ord(value))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1131_C8", "label": "return", "type": "return", "loc": [1131, 1131], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1111_C4", "vector": [13, 9, 0.2742, 0.0002, 9, 0.19, 0.8333, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return make_character(info, ord(ch), in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1132_C4", "label": "if", "type": "if", "loc": [1132, 1137], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1111_C4", "vector": [4, 9, 0.275, 0.0015, 9, 0.19, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ch in DIGITS:\n # A numeric escape sequence.\n return parse_numeric_escape(source, info, ch, in_set)\n else:\n # A literal.\n return make_character(info, ord(ch), in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1134_C8", "label": "return", "type": "return", "loc": [1134, 1134], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1132_C4", "vector": [13, 10, 0.2749, 0.0002, 10, 0.78, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_numeric_escape(source, info, ch, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1137_C8", "label": "return", "type": "return", "loc": [1137, 1137], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1132_C4", "vector": [13, 10, 0.2756, 0.0002, 10, 0.78, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return make_character(info, ord(ch), in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1139_C0", "label": "parse_numeric_escape", "type": "function", "loc": [1139, 1170], "level": 0, "parent": null, "vector": [2, 0, 0.2799, 0.0078, 0, 0.66, 0.5337, 476, 0, 4, 1, 0, 0, 0, 9], "semantic": {"name": "parse_numeric_escape", "arg_names": ["source", "info", "ch", "in_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_numeric_escape(source, info, ch, in_set):\n \"Parses a numeric escape sequence.\"\n if in_set or ch == \"0\":\n # Octal escape sequence, max 3 digits.\n return parse_octal_escape(source, info, [ch], in_set)\n\n # At least 1 digit, so either octal escape or group.\n digits = ch"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1140_C4", "label": "expression", "type": "expression", "loc": [1140, 1140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1139_C0", "vector": [8, 1, 0.2764, 0.0002, 1, 0.32, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a numeric escape sequence.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1141_C4", "label": "if", "type": "if", "loc": [1141, 1143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1139_C0", "vector": [4, 1, 0.2768, 0.0007, 1, 0.32, 0.125, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if in_set or ch == \"0\":\n # Octal escape sequence, max 3 digits.\n return parse_octal_escape(source, info, [ch], in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1143_C8", "label": "return", "type": "return", "loc": [1143, 1143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1141_C4", "vector": [13, 2, 0.2771, 0.0002, 2, 0.09, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_octal_escape(source, info, [ch], in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1146_C4", "label": "digits =", "type": "assigned_variable", "loc": [1146, 1146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1139_C0", "vector": [14, 1, 0.2778, 0.0002, 1, 0.32, 0.25, 400, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "digits", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " digits = ch"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1147_C4", "label": "saved_pos =", "type": "assigned_variable", "loc": [1147, 1147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1139_C0", "vector": [14, 1, 0.2781, 0.0002, 1, 0.32, 0.375, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1148_C4", "label": "ch = get()", "type": "assigned_variable", "loc": [1148, 1148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1139_C0", "vector": [14, 1, 0.2783, 0.0002, 1, 0.32, 0.5, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1149_C4", "label": "if", "type": "if", "loc": [1149, 1163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1139_C0", "vector": [4, 1, 0.2802, 0.0036, 1, 0.32, 0.625, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch in DIGITS:\n # At least 2 digits, so either octal escape or group.\n digits += ch\n saved_pos = source.pos\n ch = source.get()\n if is_octal(digits) and ch in OCT_DIGITS:\n # 3 octal digits, so octal escape sequence.\n encoding = info.flags & _ALL_ENCODINGS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1152_C8", "label": "saved_pos =", "type": "assigned_variable", "loc": [1152, 1152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1149_C4", "vector": [14, 2, 0.2793, 0.0002, 2, 0.29, 0.0, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1153_C8", "label": "ch = get()", "type": "assigned_variable", "loc": [1153, 1153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1149_C4", "vector": [14, 2, 0.2795, 0.0002, 2, 0.29, 0.5, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1154_C8", "label": "if", "type": "if", "loc": [1154, 1163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1149_C4", "vector": [4, 2, 0.2808, 0.0024, 2, 0.29, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if is_octal(digits) and ch in OCT_DIGITS:\n # 3 octal digits, so octal escape sequence.\n encoding = info.flags & _ALL_ENCODINGS\n if encoding == ASCII or encoding == LOCALE:\n octal_mask = 0xFF\n else:\n octal_mask = 0x1FF\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1156_C12", "label": "encoding =", "type": "assigned_variable", "loc": [1156, 1156], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1154_C8", "vector": [14, 3, 0.2802, 0.0002, 3, 0.55, 0.0, 325, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " encoding = info.flags & _ALL_ENCODINGS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1157_C12", "label": "if", "type": "if", "loc": [1157, 1160], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1154_C8", "vector": [4, 3, 0.2808, 0.001, 3, 0.55, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if encoding == ASCII or encoding == LOCALE:\n octal_mask = 0xFF\n else:\n octal_mask = 0x1FF"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1158_C16", "label": "octal_mask =", "type": "assigned_variable", "loc": [1158, 1158], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1157_C12", "vector": [14, 4, 0.2807, 0.0002, 4, 0.49, 0.0, 172, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "octal_mask", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " octal_mask = 0xFF"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1160_C16", "label": "octal_mask =", "type": "assigned_variable", "loc": [1160, 1160], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1157_C12", "vector": [14, 4, 0.2812, 0.0002, 4, 0.49, 1.0, 172, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "octal_mask", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " octal_mask = 0x1FF"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1162_C12", "label": "value =", "type": "assigned_variable", "loc": [1162, 1162], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1154_C8", "vector": [14, 3, 0.2817, 0.0002, 3, 0.55, 0.6667, 441, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = int(digits + ch, 8) & octal_mask"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1163_C12", "label": "return", "type": "return", "loc": [1163, 1163], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1154_C8", "vector": [13, 3, 0.2819, 0.0002, 3, 0.55, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return make_character(info, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1166_C4", "label": "source.pos =", "type": "assigned_variable", "loc": [1166, 1166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1139_C0", "vector": [14, 1, 0.2827, 0.0002, 1, 0.32, 0.75, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1167_C4", "label": "if", "type": "if", "loc": [1167, 1168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1139_C0", "vector": [4, 1, 0.283, 0.0005, 1, 0.32, 0.875, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if info.is_open_group(digits):\n raise error(\"cannot refer to an open group\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1170_C4", "label": "return", "type": "return", "loc": [1170, 1170], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1139_C0", "vector": [13, 1, 0.2836, 0.0002, 1, 0.32, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return make_ref_group(info, digits, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1172_C0", "label": "parse_octal_escape", "type": "function", "loc": [1172, 1186], "level": 0, "parent": null, "vector": [2, 0, 0.2858, 0.0036, 0, 0.66, 0.5389, 890, 0, 4, 1, 0, 0, 0, 8], "semantic": {"name": "parse_octal_escape", "arg_names": ["source", "info", "digits", "in_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_octal_escape(source, info, digits, in_set):\n \"Parses an octal escape sequence.\"\n saved_pos = source.pos\n ch = source.get()\n while len(digits) < 3 and ch in OCT_DIGITS:\n digits.append(ch)\n saved_pos = source.pos\n ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1173_C4", "label": "expression", "type": "expression", "loc": [1173, 1173], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1172_C0", "vector": [8, 1, 0.2844, 0.0002, 1, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses an octal escape sequence.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1174_C4", "label": "saved_pos =", "type": "assigned_variable", "loc": [1174, 1174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1172_C0", "vector": [14, 1, 0.2846, 0.0002, 1, 0.8, 0.2, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1175_C4", "label": "ch = get()", "type": "assigned_variable", "loc": [1175, 1175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1172_C0", "vector": [14, 1, 0.2848, 0.0002, 1, 0.8, 0.4, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1176_C4", "label": "while", "type": "while", "loc": [1176, 1179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1172_C0", "vector": [5, 1, 0.2855, 0.001, 1, 0.8, 0.6, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while len(digits) < 3 and ch in OCT_DIGITS:\n digits.append(ch)\n saved_pos = source.pos\n ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1177_C8", "label": "append()", "type": "expression", "loc": [1177, 1177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1176_C4", "vector": [8, 2, 0.2853, 0.0002, 2, 0.85, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " digits.append(ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1178_C8", "label": "saved_pos =", "type": "assigned_variable", "loc": [1178, 1178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1176_C4", "vector": [14, 2, 0.2856, 0.0002, 2, 0.85, 0.5, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1179_C8", "label": "ch = get()", "type": "assigned_variable", "loc": [1179, 1179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1176_C4", "vector": [14, 2, 0.2858, 0.0002, 2, 0.85, 1.0, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1181_C4", "label": "source.pos =", "type": "assigned_variable", "loc": [1181, 1181], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1172_C0", "vector": [14, 1, 0.2863, 0.0002, 1, 0.8, 0.8, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1182_C4", "label": "try", "type": "try", "loc": [1182, 1186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1172_C0", "vector": [7, 1, 0.287, 0.0012, 1, 0.8, 1.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n value = int(\"\".join(digits), 8)\n return make_character(info, value, in_set)\n except ValueError:\n raise error(\"bad octal escape\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1183_C8", "label": "value = int()", "type": "assigned_variable", "loc": [1183, 1183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1182_C4", "vector": [14, 2, 0.2868, 0.0002, 2, 0.03, 0.0, 441, 3, 2, 0, 0, 901, 10, 2], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " value = int(\"\".join(digits), 8)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1184_C8", "label": "return", "type": "return", "loc": [1184, 1184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1182_C4", "vector": [13, 2, 0.287, 0.0002, 2, 0.03, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return make_character(info, value, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1188_C0", "label": "parse_hex_escape", "type": "function", "loc": [1188, 1198], "level": 0, "parent": null, "vector": [2, 0, 0.2892, 0.0027, 0, 0.66, 0.544, 937, 0, 4, 1, 0, 0, 0, 7], "semantic": {"name": "parse_hex_escape", "arg_names": ["source", "info", "expected_len", "in_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_hex_escape(source, info, expected_len, in_set):\n \"Parses a hex escape sequence.\"\n digits = []\n for i in range(expected_len):\n ch = source.get()\n if ch not in HEX_DIGITS:\n raise error(\"bad hex escape\", source.string, source.pos)\n digits.append(ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1189_C4", "label": "expression", "type": "expression", "loc": [1189, 1189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1188_C0", "vector": [8, 1, 0.2882, 0.0002, 1, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a hex escape sequence.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1190_C4", "label": "digits =", "type": "assigned_variable", "loc": [1190, 1190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1188_C0", "vector": [14, 1, 0.2885, 0.0002, 1, 0.45, 0.25, 400, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "digits", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " digits = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1191_C4", "label": "for i", "type": "for", "loc": [1191, 1195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1188_C0", "vector": [6, 1, 0.2892, 0.0012, 1, 0.45, 0.5, 826, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(expected_len):\n ch = source.get()\n if ch not in HEX_DIGITS:\n raise error(\"bad hex escape\", source.string, source.pos)\n digits.append(ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1192_C8", "label": "ch = get()", "type": "assigned_variable", "loc": [1192, 1192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1191_C4", "vector": [14, 2, 0.289, 0.0002, 2, 0.04, 0.0, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1193_C8", "label": "if", "type": "if", "loc": [1193, 1194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1191_C4", "vector": [4, 2, 0.2893, 0.0005, 2, 0.04, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch not in HEX_DIGITS:\n raise error(\"bad hex escape\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1195_C8", "label": "append()", "type": "expression", "loc": [1195, 1195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1191_C4", "vector": [8, 2, 0.2897, 0.0002, 2, 0.04, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " digits.append(ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1197_C4", "label": "value = int()", "type": "assigned_variable", "loc": [1197, 1197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1188_C0", "vector": [14, 1, 0.2902, 0.0002, 1, 0.45, 0.75, 441, 3, 2, 0, 0, 901, 10, 2], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " value = int(\"\".join(digits), 16)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1198_C4", "label": "return", "type": "return", "loc": [1198, 1198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1188_C0", "vector": [13, 1, 0.2904, 0.0002, 1, 0.45, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return make_character(info, value, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1200_C0", "label": "parse_group_ref", "type": "function", "loc": [1200, 1209], "level": 0, "parent": null, "vector": [2, 0, 0.292, 0.0024, 0, 0.66, 0.5492, 677, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "parse_group_ref", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_group_ref(source, info):\n \"Parses a group reference.\"\n source.expect(\"<\")\n saved_pos = source.pos\n name = parse_name(source, True)\n source.expect(\">\")\n if info.is_open_group(name):\n raise error(\"cannot refer to an open group\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1201_C4", "label": "expression", "type": "expression", "loc": [1201, 1201], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1200_C0", "vector": [8, 1, 0.2912, 0.0002, 1, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a group reference.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1202_C4", "label": "expect()", "type": "expression", "loc": [1202, 1202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1200_C0", "vector": [8, 1, 0.2914, 0.0002, 1, 0.85, 0.1667, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\"<\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1203_C4", "label": "saved_pos =", "type": "assigned_variable", "loc": [1203, 1203], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1200_C0", "vector": [14, 1, 0.2916, 0.0002, 1, 0.85, 0.3333, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1204_C4", "label": "name = parse_name()", "type": "assigned_variable", "loc": [1204, 1204], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1200_C0", "vector": [14, 1, 0.2919, 0.0002, 1, 0.85, 0.5, 57, 3, 2, 0, 0, 382, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "parse_name", "annotation": ""}, "snippet": " name = parse_name(source, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1205_C4", "label": "expect()", "type": "expression", "loc": [1205, 1205], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1200_C0", "vector": [8, 1, 0.2921, 0.0002, 1, 0.85, 0.6667, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\">\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1206_C4", "label": "if", "type": "if", "loc": [1206, 1207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1200_C0", "vector": [4, 1, 0.2925, 0.0005, 1, 0.85, 0.8333, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if info.is_open_group(name):\n raise error(\"cannot refer to an open group\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1209_C4", "label": "return", "type": "return", "loc": [1209, 1209], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1200_C0", "vector": [13, 1, 0.2931, 0.0002, 1, 0.85, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return make_ref_group(info, name, saved_pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1211_C0", "label": "parse_string_set", "type": "function", "loc": [1211, 1219], "level": 0, "parent": null, "vector": [2, 0, 0.2945, 0.0022, 0, 0.66, 0.5544, 270, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "parse_string_set", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_string_set(source, info):\n \"Parses a string set reference.\"\n source.expect(\"<\")\n name = parse_name(source, True)\n source.expect(\">\")\n if name is None or name not in info.kwargs:\n raise error(\"undefined named list\", source.string, source.pos)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1212_C4", "label": "expression", "type": "expression", "loc": [1212, 1212], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1211_C0", "vector": [8, 1, 0.2938, 0.0002, 1, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a string set reference.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1213_C4", "label": "expect()", "type": "expression", "loc": [1213, 1213], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1211_C0", "vector": [8, 1, 0.2941, 0.0002, 1, 0.84, 0.2, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\"<\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1214_C4", "label": "name = parse_name()", "type": "assigned_variable", "loc": [1214, 1214], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1211_C0", "vector": [14, 1, 0.2943, 0.0002, 1, 0.84, 0.4, 57, 3, 2, 0, 0, 382, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "parse_name", "annotation": ""}, "snippet": " name = parse_name(source, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1215_C4", "label": "expect()", "type": "expression", "loc": [1215, 1215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1211_C0", "vector": [8, 1, 0.2945, 0.0002, 1, 0.84, 0.6, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\">\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1216_C4", "label": "if", "type": "if", "loc": [1216, 1217], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1211_C0", "vector": [4, 1, 0.2949, 0.0005, 1, 0.84, 0.8, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name is None or name not in info.kwargs:\n raise error(\"undefined named list\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1219_C4", "label": "return", "type": "return", "loc": [1219, 1219], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1211_C0", "vector": [13, 1, 0.2955, 0.0002, 1, 0.84, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return make_string_set(info, name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1221_C0", "label": "parse_named_char", "type": "function", "loc": [1221, 1235], "level": 0, "parent": null, "vector": [2, 0, 0.2977, 0.0036, 0, 0.66, 0.5596, 63, 0, 3, 1, 0, 0, 0, 9], "semantic": {"name": "parse_named_char", "arg_names": ["source", "info", "in_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_named_char(source, info, in_set):\n \"Parses a named character.\"\n saved_pos = source.pos\n if source.match(\"{\"):\n name = source.get_while(NAMED_CHAR_PART)\n if source.match(\"}\"):\n try:\n value = unicodedata.lookup(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1222_C4", "label": "expression", "type": "expression", "loc": [1222, 1222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1221_C0", "vector": [8, 1, 0.2962, 0.0002, 1, 0.51, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a named character.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1223_C4", "label": "saved_pos =", "type": "assigned_variable", "loc": [1223, 1223], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1221_C0", "vector": [14, 1, 0.2965, 0.0002, 1, 0.51, 0.25, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1224_C4", "label": "if", "type": "if", "loc": [1224, 1232], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1221_C0", "vector": [4, 1, 0.2977, 0.0022, 1, 0.51, 0.5, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source.match(\"{\"):\n name = source.get_while(NAMED_CHAR_PART)\n if source.match(\"}\"):\n try:\n value = unicodedata.lookup(name)\n return make_character(info, ord(value), in_set)\n except KeyError:\n raise error(\"undefined character name\", source.string,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1225_C8", "label": "name = get_while()", "type": "assigned_variable", "loc": [1225, 1225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1224_C4", "vector": [14, 2, 0.297, 0.0002, 2, 0.96, 0.0, 57, 3, 1, 0, 0, 729, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "get_while", "annotation": ""}, "snippet": " name = source.get_while(NAMED_CHAR_PART)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1226_C8", "label": "if", "type": "if", "loc": [1226, 1232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1224_C4", "vector": [4, 2, 0.2979, 0.0017, 2, 0.96, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source.match(\"}\"):\n try:\n value = unicodedata.lookup(name)\n return make_character(info, ord(value), in_set)\n except KeyError:\n raise error(\"undefined character name\", source.string,\n source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1227_C12", "label": "try", "type": "try", "loc": [1227, 1232], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1226_C8", "vector": [7, 3, 0.2981, 0.0015, 3, 0.41, 0.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n value = unicodedata.lookup(name)\n return make_character(info, ord(value), in_set)\n except KeyError:\n raise error(\"undefined character name\", source.string,\n source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1228_C16", "label": "value = lookup()", "type": "assigned_variable", "loc": [1228, 1228], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1227_C12", "vector": [14, 4, 0.2977, 0.0002, 4, 0.05, 0.0, 441, 3, 1, 0, 0, 955, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "lookup", "annotation": ""}, "snippet": " value = unicodedata.lookup(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1229_C16", "label": "return", "type": "return", "loc": [1229, 1229], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1227_C12", "vector": [13, 4, 0.2979, 0.0002, 4, 0.05, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return make_character(info, ord(value), in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1234_C4", "label": "source.pos =", "type": "assigned_variable", "loc": [1234, 1234], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1221_C0", "vector": [14, 1, 0.2992, 0.0002, 1, 0.51, 0.75, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1235_C4", "label": "return", "type": "return", "loc": [1235, 1235], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1221_C0", "vector": [13, 1, 0.2994, 0.0002, 1, 0.51, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return make_character(info, ord(\"N\"), in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1237_C0", "label": "parse_property", "type": "function", "loc": [1237, 1256], "level": 0, "parent": null, "vector": [2, 0, 0.3022, 0.0048, 0, 0.66, 0.5648, 945, 0, 4, 1, 0, 0, 0, 10], "semantic": {"name": "parse_property", "arg_names": ["source", "info", "positive", "in_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_property(source, info, positive, in_set):\n \"Parses a Unicode property.\"\n saved_pos = source.pos\n ch = source.get()\n if ch == \"{\":\n negate = source.match(\"^\")\n prop_name, name = parse_property_name(source)\n if source.match(\"}\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1238_C4", "label": "expression", "type": "expression", "loc": [1238, 1238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1237_C0", "vector": [8, 1, 0.3001, 0.0002, 1, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a Unicode property.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1239_C4", "label": "saved_pos =", "type": "assigned_variable", "loc": [1239, 1239], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1237_C0", "vector": [14, 1, 0.3004, 0.0002, 1, 0.7, 0.1667, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1240_C4", "label": "ch = get()", "type": "assigned_variable", "loc": [1240, 1240], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1237_C0", "vector": [14, 1, 0.3006, 0.0002, 1, 0.7, 0.3333, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1241_C4", "label": "if", "type": "if", "loc": [1241, 1251], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1237_C0", "vector": [4, 1, 0.3021, 0.0027, 1, 0.7, 0.5, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"{\":\n negate = source.match(\"^\")\n prop_name, name = parse_property_name(source)\n if source.match(\"}\"):\n # It's correctly delimited.\n prop = lookup_property(prop_name, name, positive != negate, source)\n return make_property(info, prop, in_set)\n elif ch and ch in \"CLMNPSZ\":"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1242_C8", "label": "negate = match()", "type": "assigned_variable", "loc": [1242, 1242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1241_C4", "vector": [14, 2, 0.3011, 0.0002, 2, 0.82, 0.0, 426, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "negate", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " negate = source.match(\"^\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1243_C8", "label": "prop_name, name = parse_property_name()", "type": "assigned_variable", "loc": [1243, 1243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1241_C4", "vector": [14, 2, 0.3013, 0.0002, 2, 0.82, 0.3333, 411, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "prop_name, name", "arg_names": [], "import_names": [], "rhs_call_name": "parse_property_name", "annotation": ""}, "snippet": " prop_name, name = parse_property_name(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1244_C8", "label": "if", "type": "if", "loc": [1244, 1247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1241_C4", "vector": [4, 2, 0.3019, 0.001, 2, 0.82, 0.6667, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source.match(\"}\"):\n # It's correctly delimited.\n prop = lookup_property(prop_name, name, positive != negate, source)\n return make_property(info, prop, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1246_C12", "label": "prop = lookup_property()", "type": "assigned_variable", "loc": [1246, 1246], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1244_C8", "vector": [14, 3, 0.3021, 0.0002, 3, 0.87, 0.0, 17, 3, 4, 0, 0, 450, 10, 1], "semantic": {"name": "prop", "arg_names": [], "import_names": [], "rhs_call_name": "lookup_property", "annotation": ""}, "snippet": " prop = lookup_property(prop_name, name, positive != negate, source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1247_C12", "label": "return", "type": "return", "loc": [1247, 1247], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1244_C8", "vector": [13, 3, 0.3023, 0.0002, 3, 0.87, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return make_property(info, prop, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1248_C4", "label": "if", "type": "if", "loc": [1248, 1251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1241_C4", "vector": [4, 2, 0.3029, 0.001, 2, 0.82, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ch and ch in \"CLMNPSZ\":\n # An abbreviated property, eg \\pL.\n prop = lookup_property(None, ch, positive, source)\n return make_property(info, prop, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1250_C8", "label": "prop = lookup_property()", "type": "assigned_variable", "loc": [1250, 1250], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1248_C4", "vector": [14, 3, 0.303, 0.0002, 3, 0.95, 0.0, 17, 3, 4, 0, 0, 450, 10, 1], "semantic": {"name": "prop", "arg_names": [], "import_names": [], "rhs_call_name": "lookup_property", "annotation": ""}, "snippet": " prop = lookup_property(None, ch, positive, source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1251_C8", "label": "return", "type": "return", "loc": [1251, 1251], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1248_C4", "vector": [13, 3, 0.3033, 0.0002, 3, 0.95, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return make_property(info, prop, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1254_C4", "label": "source.pos =", "type": "assigned_variable", "loc": [1254, 1254], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1237_C0", "vector": [14, 1, 0.304, 0.0002, 1, 0.7, 0.6667, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1255_C4", "label": "ch =", "type": "assigned_variable", "loc": [1255, 1255], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1237_C0", "vector": [14, 1, 0.3042, 0.0002, 1, 0.7, 0.8333, 263, 8, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ch = \"p\" if positive else \"P\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1256_C4", "label": "return", "type": "return", "loc": [1256, 1256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1237_C0", "vector": [13, 1, 0.3045, 0.0002, 1, 0.7, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return make_character(info, ord(ch), in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1258_C0", "label": "parse_property_name", "type": "function", "loc": [1258, 1278], "level": 0, "parent": null, "vector": [2, 0, 0.3074, 0.0051, 0, 0.66, 0.5699, 545, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "parse_property_name", "arg_names": ["source"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_property_name(source):\n \"Parses a property name, which may be qualified.\"\n name = source.get_while(PROPERTY_NAME_PART)\n saved_pos = source.pos\n\n ch = source.get()\n if ch and ch in \":=\":\n prop_name = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1259_C4", "label": "expression", "type": "expression", "loc": [1259, 1259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1258_C0", "vector": [8, 1, 0.3052, 0.0002, 1, 0.02, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a property name, which may be qualified.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1260_C4", "label": "name = get_while()", "type": "assigned_variable", "loc": [1260, 1260], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1258_C0", "vector": [14, 1, 0.3055, 0.0002, 1, 0.02, 0.1667, 57, 3, 1, 0, 0, 729, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "get_while", "annotation": ""}, "snippet": " name = source.get_while(PROPERTY_NAME_PART)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1261_C4", "label": "saved_pos =", "type": "assigned_variable", "loc": [1261, 1261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1258_C0", "vector": [14, 1, 0.3057, 0.0002, 1, 0.02, 0.3333, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1263_C4", "label": "ch = get()", "type": "assigned_variable", "loc": [1263, 1263], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1258_C0", "vector": [14, 1, 0.3062, 0.0002, 1, 0.02, 0.5, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1264_C4", "label": "if", "type": "if", "loc": [1264, 1275], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1258_C0", "vector": [4, 1, 0.3078, 0.0029, 1, 0.02, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch and ch in \":=\":\n prop_name = name\n name = source.get_while(ALNUM | set(\" &_-./\")).strip()\n\n if name:\n # Name after the \":\" or \"=\", so it's a qualified name.\n saved_pos = source.pos\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1265_C8", "label": "prop_name =", "type": "assigned_variable", "loc": [1265, 1265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1264_C4", "vector": [14, 2, 0.3067, 0.0002, 2, 0.21, 0.0, 117, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prop_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prop_name = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1266_C8", "label": "name = strip()", "type": "assigned_variable", "loc": [1266, 1266], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1264_C4", "vector": [14, 2, 0.3069, 0.0002, 2, 0.21, 0.3333, 57, 3, 0, 0, 0, 973, 10, 3], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " name = source.get_while(ALNUM | set(\" &_-./\")).strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1268_C8", "label": "if", "type": "if", "loc": [1268, 1273], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1264_C4", "vector": [4, 2, 0.308, 0.0015, 2, 0.21, 0.6667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name:\n # Name after the \":\" or \"=\", so it's a qualified name.\n saved_pos = source.pos\n else:\n # No name after the \":\" or \"=\", so assume it's an unqualified name.\n prop_name, name = None, prop_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1270_C12", "label": "saved_pos =", "type": "assigned_variable", "loc": [1270, 1270], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1268_C8", "vector": [14, 3, 0.3079, 0.0002, 3, 0.48, 0.0, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1273_C12", "label": "prop_name, name =", "type": "assigned_variable", "loc": [1273, 1273], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1268_C8", "vector": [14, 3, 0.3086, 0.0002, 3, 0.48, 1.0, 411, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "prop_name, name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prop_name, name = None, prop_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1275_C8", "label": "prop_name =", "type": "assigned_variable", "loc": [1275, 1275], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1264_C4", "vector": [14, 2, 0.3091, 0.0002, 2, 0.21, 1.0, 117, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "prop_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prop_name = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1277_C4", "label": "source.pos =", "type": "assigned_variable", "loc": [1277, 1277], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1258_C0", "vector": [14, 1, 0.3096, 0.0002, 1, 0.02, 0.8333, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1278_C4", "label": "return", "type": "return", "loc": [1278, 1278], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1258_C0", "vector": [13, 1, 0.3098, 0.0002, 1, 0.02, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return prop_name, name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1280_C0", "label": "parse_set", "type": "function", "loc": [1280, 1304], "level": 0, "parent": null, "vector": [2, 0, 0.3132, 0.0061, 0, 0.66, 0.5751, 289, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "parse_set", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_set(source, info):\n \"Parses a character set.\"\n version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION\n\n saved_ignore = source.ignore_space\n source.ignore_space = False\n # Negative set?\n negate = source.match(\"^\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1281_C4", "label": "expression", "type": "expression", "loc": [1281, 1281], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1280_C0", "vector": [8, 1, 0.3105, 0.0002, 1, 0.9, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a character set.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1282_C4", "label": "version =", "type": "assigned_variable", "loc": [1282, 1282], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1280_C0", "vector": [14, 1, 0.3108, 0.0002, 1, 0.9, 0.125, 623, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1284_C4", "label": "saved_ignore =", "type": "assigned_variable", "loc": [1284, 1284], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1280_C0", "vector": [14, 1, 0.3113, 0.0002, 1, 0.9, 0.25, 687, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_ignore", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_ignore = source.ignore_space"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1285_C4", "label": "source.ignore_space =", "type": "assigned_variable", "loc": [1285, 1285], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1280_C0", "vector": [14, 1, 0.3115, 0.0002, 1, 0.9, 0.375, 890, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "source.ignore_space", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.ignore_space = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1287_C4", "label": "negate = match()", "type": "assigned_variable", "loc": [1287, 1287], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1280_C0", "vector": [14, 1, 0.312, 0.0002, 1, 0.9, 0.5, 426, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "negate", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " negate = source.match(\"^\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1288_C4", "label": "try", "type": "try", "loc": [1288, 1297], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1280_C0", "vector": [7, 1, 0.3133, 0.0024, 1, 0.9, 0.625, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if version == VERSION0:\n item = parse_set_imp_union(source, info)\n else:\n item = parse_set_union(source, info)\n\n if not source.match(\"]\"):\n raise error(\"missing ]\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1289_C8", "label": "if", "type": "if", "loc": [1289, 1292], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1288_C4", "vector": [4, 2, 0.3128, 0.001, 2, 0.04, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version == VERSION0:\n item = parse_set_imp_union(source, info)\n else:\n item = parse_set_union(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1290_C12", "label": "item = parse_set_imp_union()", "type": "assigned_variable", "loc": [1290, 1290], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1289_C8", "vector": [14, 3, 0.3127, 0.0002, 3, 0.89, 0.0, 434, 3, 2, 0, 0, 121, 10, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "parse_set_imp_union", "annotation": ""}, "snippet": " item = parse_set_imp_union(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1292_C12", "label": "item = parse_set_union()", "type": "assigned_variable", "loc": [1292, 1292], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1289_C8", "vector": [14, 3, 0.3132, 0.0002, 3, 0.89, 1.0, 434, 3, 2, 0, 0, 923, 10, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "parse_set_union", "annotation": ""}, "snippet": " item = parse_set_union(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1294_C8", "label": "if", "type": "if", "loc": [1294, 1295], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1288_C4", "vector": [4, 2, 0.3138, 0.0005, 2, 0.04, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not source.match(\"]\"):\n raise error(\"missing ]\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1297_C8", "label": "source.ignore_space =", "type": "assigned_variable", "loc": [1297, 1297], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1288_C4", "vector": [14, 2, 0.3144, 0.0002, 2, 0.04, 1.0, 890, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.ignore_space", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.ignore_space = saved_ignore"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1299_C4", "label": "if", "type": "if", "loc": [1299, 1300], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1280_C0", "vector": [4, 1, 0.315, 0.0005, 1, 0.9, 0.75, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if negate:\n item = item.with_flags(positive=not item.positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1300_C8", "label": "item = with_flags()", "type": "assigned_variable", "loc": [1300, 1300], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1299_C4", "vector": [14, 2, 0.3152, 0.0002, 2, 0.9, 0.0, 434, 3, 1, 0, 0, 795, 10, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "with_flags", "annotation": ""}, "snippet": " item = item.with_flags(positive=not item.positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1302_C4", "label": "item = with_flags()", "type": "assigned_variable", "loc": [1302, 1302], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1280_C0", "vector": [14, 1, 0.3156, 0.0002, 1, 0.9, 0.875, 434, 3, 1, 0, 0, 795, 10, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "with_flags", "annotation": ""}, "snippet": " item = item.with_flags(case_flags=info.flags & CASE_FLAGS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1304_C4", "label": "return", "type": "return", "loc": [1304, 1304], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1280_C0", "vector": [13, 1, 0.3161, 0.0002, 1, 0.9, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return item"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1306_C0", "label": "parse_set_union", "type": "function", "loc": [1306, 1314], "level": 0, "parent": null, "vector": [2, 0, 0.3176, 0.0022, 0, 0.66, 0.5803, 923, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "parse_set_union", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_set_union(source, info):\n \"Parses a set union ([x||y]).\"\n items = [parse_set_symm_diff(source, info)]\n while source.match(\"||\"):\n items.append(parse_set_symm_diff(source, info))\n\n if len(items) == 1:\n return items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1307_C4", "label": "expression", "type": "expression", "loc": [1307, 1307], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1306_C0", "vector": [8, 1, 0.3168, 0.0002, 1, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a set union ([x||y]).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1308_C4", "label": "items =", "type": "assigned_variable", "loc": [1308, 1308], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1306_C0", "vector": [14, 1, 0.3171, 0.0002, 1, 0.8, 0.25, 339, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = [parse_set_symm_diff(source, info)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1309_C4", "label": "while", "type": "while", "loc": [1309, 1310], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1306_C0", "vector": [5, 1, 0.3175, 0.0005, 1, 0.8, 0.5, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while source.match(\"||\"):\n items.append(parse_set_symm_diff(source, info))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1310_C8", "label": "append()", "type": "expression", "loc": [1310, 1310], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1309_C4", "vector": [8, 2, 0.3176, 0.0002, 2, 0.26, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " items.append(parse_set_symm_diff(source, info))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1312_C4", "label": "if", "type": "if", "loc": [1312, 1313], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1306_C0", "vector": [4, 1, 0.3182, 0.0005, 1, 0.8, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(items) == 1:\n return items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1313_C8", "label": "return", "type": "return", "loc": [1313, 1313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1312_C4", "vector": [13, 2, 0.3183, 0.0002, 2, 0.04, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1314_C4", "label": "return", "type": "return", "loc": [1314, 1314], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1306_C0", "vector": [13, 1, 0.3185, 0.0002, 1, 0.8, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return SetUnion(info, items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1316_C0", "label": "parse_set_symm_diff", "type": "function", "loc": [1316, 1324], "level": 0, "parent": null, "vector": [2, 0, 0.32, 0.0022, 0, 0.66, 0.5855, 223, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "parse_set_symm_diff", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_set_symm_diff(source, info):\n \"Parses a set symmetric difference ([x~~y]).\"\n items = [parse_set_inter(source, info)]\n while source.match(\"~~\"):\n items.append(parse_set_inter(source, info))\n\n if len(items) == 1:\n return items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1317_C4", "label": "expression", "type": "expression", "loc": [1317, 1317], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1316_C0", "vector": [8, 1, 0.3193, 0.0002, 1, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a set symmetric difference ([x~~y]).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1318_C4", "label": "items =", "type": "assigned_variable", "loc": [1318, 1318], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1316_C0", "vector": [14, 1, 0.3195, 0.0002, 1, 0.07, 0.25, 339, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = [parse_set_inter(source, info)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1319_C4", "label": "while", "type": "while", "loc": [1319, 1320], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1316_C0", "vector": [5, 1, 0.3199, 0.0005, 1, 0.07, 0.5, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while source.match(\"~~\"):\n items.append(parse_set_inter(source, info))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1320_C8", "label": "append()", "type": "expression", "loc": [1320, 1320], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1319_C4", "vector": [8, 2, 0.32, 0.0002, 2, 0.27, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " items.append(parse_set_inter(source, info))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1322_C4", "label": "if", "type": "if", "loc": [1322, 1323], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1316_C0", "vector": [4, 1, 0.3206, 0.0005, 1, 0.07, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(items) == 1:\n return items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1323_C8", "label": "return", "type": "return", "loc": [1323, 1323], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1322_C4", "vector": [13, 2, 0.3207, 0.0002, 2, 0.48, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1324_C4", "label": "return", "type": "return", "loc": [1324, 1324], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1316_C0", "vector": [13, 1, 0.321, 0.0002, 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 SetSymDiff(info, items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1326_C0", "label": "parse_set_inter", "type": "function", "loc": [1326, 1334], "level": 0, "parent": null, "vector": [2, 0, 0.3224, 0.0022, 0, 0.66, 0.5907, 80, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "parse_set_inter", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_set_inter(source, info):\n \"Parses a set intersection ([x&&y]).\"\n items = [parse_set_diff(source, info)]\n while source.match(\"&&\"):\n items.append(parse_set_diff(source, info))\n\n if len(items) == 1:\n return items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1327_C4", "label": "expression", "type": "expression", "loc": [1327, 1327], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1326_C0", "vector": [8, 1, 0.3217, 0.0002, 1, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a set intersection ([x&&y]).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1328_C4", "label": "items =", "type": "assigned_variable", "loc": [1328, 1328], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1326_C0", "vector": [14, 1, 0.3219, 0.0002, 1, 0.28, 0.25, 339, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = [parse_set_diff(source, info)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1329_C4", "label": "while", "type": "while", "loc": [1329, 1330], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1326_C0", "vector": [5, 1, 0.3223, 0.0005, 1, 0.28, 0.5, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while source.match(\"&&\"):\n items.append(parse_set_diff(source, info))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1330_C8", "label": "append()", "type": "expression", "loc": [1330, 1330], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1329_C4", "vector": [8, 2, 0.3224, 0.0002, 2, 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": " items.append(parse_set_diff(source, info))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1332_C4", "label": "if", "type": "if", "loc": [1332, 1333], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1326_C0", "vector": [4, 1, 0.323, 0.0005, 1, 0.28, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(items) == 1:\n return items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1333_C8", "label": "return", "type": "return", "loc": [1333, 1333], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1332_C4", "vector": [13, 2, 0.3232, 0.0002, 2, 0.74, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1334_C4", "label": "return", "type": "return", "loc": [1334, 1334], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1326_C0", "vector": [13, 1, 0.3234, 0.0002, 1, 0.28, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return SetInter(info, items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1336_C0", "label": "parse_set_diff", "type": "function", "loc": [1336, 1344], "level": 0, "parent": null, "vector": [2, 0, 0.3248, 0.0022, 0, 0.66, 0.5959, 303, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "parse_set_diff", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_set_diff(source, info):\n \"Parses a set difference ([x--y]).\"\n items = [parse_set_imp_union(source, info)]\n while source.match(\"--\"):\n items.append(parse_set_imp_union(source, info))\n\n if len(items) == 1:\n return items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1337_C4", "label": "expression", "type": "expression", "loc": [1337, 1337], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1336_C0", "vector": [8, 1, 0.3241, 0.0002, 1, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a set difference ([x--y]).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1338_C4", "label": "items =", "type": "assigned_variable", "loc": [1338, 1338], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1336_C0", "vector": [14, 1, 0.3244, 0.0002, 1, 0.88, 0.25, 339, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = [parse_set_imp_union(source, info)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1339_C4", "label": "while", "type": "while", "loc": [1339, 1340], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1336_C0", "vector": [5, 1, 0.3247, 0.0005, 1, 0.88, 0.5, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while source.match(\"--\"):\n items.append(parse_set_imp_union(source, info))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1340_C8", "label": "append()", "type": "expression", "loc": [1340, 1340], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1339_C4", "vector": [8, 2, 0.3248, 0.0002, 2, 0.36, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " items.append(parse_set_imp_union(source, info))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1342_C4", "label": "if", "type": "if", "loc": [1342, 1343], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1336_C0", "vector": [4, 1, 0.3255, 0.0005, 1, 0.88, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(items) == 1:\n return items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1343_C8", "label": "return", "type": "return", "loc": [1343, 1343], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1342_C4", "vector": [13, 2, 0.3256, 0.0002, 2, 0.01, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1344_C4", "label": "return", "type": "return", "loc": [1344, 1344], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1336_C0", "vector": [13, 1, 0.3258, 0.0002, 1, 0.88, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return SetDiff(info, items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1346_C0", "label": "parse_set_imp_union", "type": "function", "loc": [1346, 1367], "level": 0, "parent": null, "vector": [2, 0, 0.3288, 0.0053, 0, 0.66, 0.601, 121, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "parse_set_imp_union", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_set_imp_union(source, info):\n \"Parses a set implicit union ([xy]).\"\n version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION\n\n items = [parse_set_member(source, info)]\n while True:\n saved_pos = source.pos\n if source.match(\"]\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1347_C4", "label": "expression", "type": "expression", "loc": [1347, 1347], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1346_C0", "vector": [8, 1, 0.3265, 0.0002, 1, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a set implicit union ([xy]).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1348_C4", "label": "version =", "type": "assigned_variable", "loc": [1348, 1348], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1346_C0", "vector": [14, 1, 0.3268, 0.0002, 1, 0.99, 0.2, 623, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1350_C4", "label": "items =", "type": "assigned_variable", "loc": [1350, 1350], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1346_C0", "vector": [14, 1, 0.3273, 0.0002, 1, 0.99, 0.4, 339, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = [parse_set_member(source, info)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1351_C4", "label": "while", "type": "while", "loc": [1351, 1363], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1346_C0", "vector": [5, 1, 0.329, 0.0032, 1, 0.99, 0.6, 0, 1, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n saved_pos = source.pos\n if source.match(\"]\"):\n # End of the set.\n source.pos = saved_pos\n break\n\n if version == VERSION1 and any(source.match(op) for op in SET_OPS):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1352_C8", "label": "saved_pos =", "type": "assigned_variable", "loc": [1352, 1352], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1351_C4", "vector": [14, 2, 0.3278, 0.0002, 2, 0.88, 0.0, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1353_C8", "label": "if", "type": "if", "loc": [1353, 1356], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1351_C4", "vector": [4, 2, 0.3284, 0.001, 2, 0.88, 0.3333, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source.match(\"]\"):\n # End of the set.\n source.pos = saved_pos\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1355_C12", "label": "source.pos =", "type": "assigned_variable", "loc": [1355, 1355], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1353_C8", "vector": [14, 3, 0.3285, 0.0002, 3, 0.82, 0.0, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1358_C8", "label": "if", "type": "if", "loc": [1358, 1361], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1351_C4", "vector": [4, 2, 0.3296, 0.001, 2, 0.88, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version == VERSION1 and any(source.match(op) for op in SET_OPS):\n # The new behaviour has set operators.\n source.pos = saved_pos\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1360_C12", "label": "source.pos =", "type": "assigned_variable", "loc": [1360, 1360], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1358_C8", "vector": [14, 3, 0.3297, 0.0002, 3, 0.46, 0.0, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1363_C8", "label": "append()", "type": "expression", "loc": [1363, 1363], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1351_C4", "vector": [8, 2, 0.3304, 0.0002, 2, 0.88, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " items.append(parse_set_member(source, info))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1365_C4", "label": "if", "type": "if", "loc": [1365, 1366], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1346_C0", "vector": [4, 1, 0.331, 0.0005, 1, 0.99, 0.8, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(items) == 1:\n return items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1366_C8", "label": "return", "type": "return", "loc": [1366, 1366], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1365_C4", "vector": [13, 2, 0.3312, 0.0002, 2, 0.71, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1367_C4", "label": "return", "type": "return", "loc": [1367, 1367], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1346_C0", "vector": [13, 1, 0.3314, 0.0002, 1, 0.99, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return SetUnion(info, items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "label": "parse_set_member", "type": "function", "loc": [1369, 1408], "level": 0, "parent": null, "vector": [2, 0, 0.3366, 0.0097, 0, 0.66, 0.6062, 902, 0, 2, 1, 0, 0, 0, 15], "semantic": {"name": "parse_set_member", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_set_member(source, info):\n \"Parses a member in a character set.\"\n # Parse a set item.\n start = parse_set_item(source, info)\n saved_pos1 = source.pos\n if (not isinstance(start, Character) or not start.positive or not\n source.match(\"-\")):\n # It's not the start of a range."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1370_C4", "label": "expression", "type": "expression", "loc": [1370, 1370], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "vector": [8, 1, 0.3321, 0.0002, 1, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a member in a character set.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1372_C4", "label": "start = parse_set_item()", "type": "assigned_variable", "loc": [1372, 1372], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "vector": [14, 1, 0.3326, 0.0002, 1, 0.13, 0.0833, 511, 3, 2, 0, 0, 425, 10, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "parse_set_item", "annotation": ""}, "snippet": " start = parse_set_item(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1373_C4", "label": "saved_pos1 =", "type": "assigned_variable", "loc": [1373, 1373], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "vector": [14, 1, 0.3328, 0.0002, 1, 0.13, 0.1667, 205, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos1 = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1374_C4", "label": "if", "type": "if", "loc": [1374, 1377], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "vector": [4, 1, 0.3335, 0.001, 1, 0.13, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not isinstance(start, Character) or not start.positive or not\n source.match(\"-\")):\n # It's not the start of a range.\n return start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1377_C8", "label": "return", "type": "return", "loc": [1377, 1377], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1374_C4", "vector": [13, 2, 0.3338, 0.0002, 2, 0.67, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1379_C4", "label": "version =", "type": "assigned_variable", "loc": [1379, 1379], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "vector": [14, 1, 0.3343, 0.0002, 1, 0.13, 0.3333, 623, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1382_C4", "label": "saved_pos2 =", "type": "assigned_variable", "loc": [1382, 1382], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "vector": [14, 1, 0.335, 0.0002, 1, 0.13, 0.4167, 534, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos2 = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1383_C4", "label": "if", "type": "if", "loc": [1383, 1387], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "vector": [4, 1, 0.3358, 0.0012, 1, 0.13, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version == VERSION1 and source.match(\"-\"):\n # It's actually the set difference operator '--', so return the\n # character.\n source.pos = saved_pos1\n return start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1386_C8", "label": "source.pos =", "type": "assigned_variable", "loc": [1386, 1386], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1383_C4", "vector": [14, 2, 0.336, 0.0002, 2, 0.35, 0.0, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1387_C8", "label": "return", "type": "return", "loc": [1387, 1387], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1383_C4", "vector": [13, 2, 0.3362, 0.0002, 2, 0.35, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1389_C4", "label": "if", "type": "if", "loc": [1389, 1393], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "vector": [4, 1, 0.3372, 0.0012, 1, 0.13, 0.5833, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source.match(\"]\"):\n # We've reached the end of the set, so return both the character and\n # hyphen.\n source.pos = saved_pos2\n return SetUnion(info, [start, Character(ord(\"-\"))])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1392_C8", "label": "source.pos =", "type": "assigned_variable", "loc": [1392, 1392], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1389_C4", "vector": [14, 2, 0.3375, 0.0002, 2, 0.47, 0.0, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1393_C8", "label": "return", "type": "return", "loc": [1393, 1393], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1389_C4", "vector": [13, 2, 0.3377, 0.0002, 2, 0.47, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return SetUnion(info, [start, Character(ord(\"-\"))])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1396_C4", "label": "end = parse_set_item()", "type": "assigned_variable", "loc": [1396, 1396], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "vector": [14, 1, 0.3384, 0.0002, 1, 0.13, 0.6667, 128, 3, 2, 0, 0, 425, 10, 1], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "parse_set_item", "annotation": ""}, "snippet": " end = parse_set_item(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1397_C4", "label": "if", "type": "if", "loc": [1397, 1399], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "vector": [4, 1, 0.3389, 0.0007, 1, 0.13, 0.75, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(end, Character) or not end.positive:\n # It's not a range, so return the character, hyphen and property.\n return SetUnion(info, [start, Character(ord(\"-\")), end])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1399_C8", "label": "return", "type": "return", "loc": [1399, 1399], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1397_C4", "vector": [13, 2, 0.3392, 0.0002, 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 SetUnion(info, [start, Character(ord(\"-\")), end])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1402_C4", "label": "if", "type": "if", "loc": [1402, 1403], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "vector": [4, 1, 0.34, 0.0005, 1, 0.13, 0.8333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if start.value > end.value:\n raise error(\"bad character range\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1405_C4", "label": "if", "type": "if", "loc": [1405, 1406], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "vector": [4, 1, 0.3407, 0.0005, 1, 0.13, 0.9167, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if start.value == end.value:\n return start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1406_C8", "label": "return", "type": "return", "loc": [1406, 1406], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1405_C4", "vector": [13, 2, 0.3408, 0.0002, 2, 0.01, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1408_C4", "label": "return", "type": "return", "loc": [1408, 1408], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "vector": [13, 1, 0.3413, 0.0002, 1, 0.13, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Range(start.value, end.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1410_C0", "label": "parse_set_item", "type": "function", "loc": [1410, 1446], "level": 0, "parent": null, "vector": [2, 0, 0.3462, 0.009, 0, 0.66, 0.6114, 425, 0, 2, 1, 0, 0, 0, 14], "semantic": {"name": "parse_set_item", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_set_item(source, info):\n \"Parses an item in a character set.\"\n version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION\n\n if source.match(\"\\\\\"):\n # An escape sequence in a set.\n return parse_escape(source, info, True)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1411_C4", "label": "expression", "type": "expression", "loc": [1411, 1411], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1410_C0", "vector": [8, 1, 0.3421, 0.0002, 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 an item in a character set.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1412_C4", "label": "version =", "type": "assigned_variable", "loc": [1412, 1412], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1410_C0", "vector": [14, 1, 0.3423, 0.0002, 1, 0.44, 0.125, 623, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1414_C4", "label": "if", "type": "if", "loc": [1414, 1416], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1410_C0", "vector": [4, 1, 0.343, 0.0007, 1, 0.44, 0.25, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source.match(\"\\\\\"):\n # An escape sequence in a set.\n return parse_escape(source, info, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1416_C8", "label": "return", "type": "return", "loc": [1416, 1416], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1414_C4", "vector": [13, 2, 0.3433, 0.0002, 2, 0.26, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_escape(source, info, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1418_C4", "label": "saved_pos =", "type": "assigned_variable", "loc": [1418, 1418], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1410_C0", "vector": [14, 1, 0.3438, 0.0002, 1, 0.44, 0.375, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1419_C4", "label": "if", "type": "if", "loc": [1419, 1425], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1410_C0", "vector": [4, 1, 0.3447, 0.0017, 1, 0.44, 0.5, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source.match(\"[:\"):\n # Looks like a POSIX character class.\n try:\n return parse_posix_class(source, info)\n except ParseError:\n # Not a POSIX character class.\n source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1421_C8", "label": "try", "type": "try", "loc": [1421, 1425], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1419_C4", "vector": [7, 2, 0.345, 0.0012, 2, 0.93, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return parse_posix_class(source, info)\n except ParseError:\n # Not a POSIX character class.\n source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1422_C12", "label": "return", "type": "return", "loc": [1422, 1422], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1421_C8", "vector": [13, 3, 0.3447, 0.0002, 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 parse_posix_class(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1425_C12", "label": "source.pos =", "type": "assigned_variable", "loc": [1425, 1425], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1421_C8", "vector": [14, 3, 0.3455, 0.0002, 3, 0.31, 0.0, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1427_C4", "label": "if", "type": "if", "loc": [1427, 1440], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1410_C0", "vector": [4, 1, 0.3475, 0.0034, 1, 0.44, 0.625, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version == VERSION1 and source.match(\"[\"):\n # It's the start of a nested set.\n\n # Negative set?\n negate = source.match(\"^\")\n item = parse_set_union(source, info)\n\n if not source.match(\"]\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1431_C8", "label": "negate = match()", "type": "assigned_variable", "loc": [1431, 1431], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1427_C4", "vector": [14, 2, 0.3469, 0.0002, 2, 0.01, 0.0, 426, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "negate", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " negate = source.match(\"^\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1432_C8", "label": "item = parse_set_union()", "type": "assigned_variable", "loc": [1432, 1432], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1427_C4", "vector": [14, 2, 0.3472, 0.0002, 2, 0.01, 0.25, 434, 3, 2, 0, 0, 923, 10, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "parse_set_union", "annotation": ""}, "snippet": " item = parse_set_union(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1434_C8", "label": "if", "type": "if", "loc": [1434, 1435], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1427_C4", "vector": [4, 2, 0.3478, 0.0005, 2, 0.01, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not source.match(\"]\"):\n raise error(\"missing ]\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1437_C8", "label": "if", "type": "if", "loc": [1437, 1438], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1427_C4", "vector": [4, 2, 0.3485, 0.0005, 2, 0.01, 0.75, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if negate:\n item = item.with_flags(positive=not item.positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1438_C12", "label": "item = with_flags()", "type": "assigned_variable", "loc": [1438, 1438], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1437_C8", "vector": [14, 3, 0.3486, 0.0002, 3, 0.72, 0.0, 434, 3, 1, 0, 0, 795, 10, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "with_flags", "annotation": ""}, "snippet": " item = item.with_flags(positive=not item.positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1440_C8", "label": "return", "type": "return", "loc": [1440, 1440], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1427_C4", "vector": [13, 2, 0.3491, 0.0002, 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 item"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1442_C4", "label": "ch = get()", "type": "assigned_variable", "loc": [1442, 1442], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1410_C0", "vector": [14, 1, 0.3496, 0.0002, 1, 0.44, 0.75, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1443_C4", "label": "if", "type": "if", "loc": [1443, 1444], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1410_C0", "vector": [4, 1, 0.3499, 0.0005, 1, 0.44, 0.875, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not ch:\n raise error(\"bad set\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1446_C4", "label": "return", "type": "return", "loc": [1446, 1446], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1410_C0", "vector": [13, 1, 0.3505, 0.0002, 1, 0.44, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Character(ord(ch))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1448_C0", "label": "parse_posix_class", "type": "function", "loc": [1448, 1455], "level": 0, "parent": null, "vector": [2, 0, 0.3519, 0.0019, 0, 0.66, 0.6166, 3, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "parse_posix_class", "arg_names": ["source", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_posix_class(source, info):\n \"Parses a POSIX character class.\"\n negate = source.match(\"^\")\n prop_name, name = parse_property_name(source)\n if not source.match(\":]\"):\n raise ParseError()\n\n return lookup_property(prop_name, name, not negate, source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1449_C4", "label": "expression", "type": "expression", "loc": [1449, 1449], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1448_C0", "vector": [8, 1, 0.3513, 0.0002, 1, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a POSIX character class.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1450_C4", "label": "negate = match()", "type": "assigned_variable", "loc": [1450, 1450], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1448_C0", "vector": [14, 1, 0.3515, 0.0002, 1, 0.67, 0.25, 426, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "negate", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " negate = source.match(\"^\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1451_C4", "label": "prop_name, name = parse_property_name()", "type": "assigned_variable", "loc": [1451, 1451], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1448_C0", "vector": [14, 1, 0.3518, 0.0002, 1, 0.67, 0.5, 411, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "prop_name, name", "arg_names": [], "import_names": [], "rhs_call_name": "parse_property_name", "annotation": ""}, "snippet": " prop_name, name = parse_property_name(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1452_C4", "label": "if", "type": "if", "loc": [1452, 1453], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1448_C0", "vector": [4, 1, 0.3521, 0.0005, 1, 0.67, 0.75, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not source.match(\":]\"):\n raise ParseError()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1455_C4", "label": "return", "type": "return", "loc": [1455, 1455], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1448_C0", "vector": [13, 1, 0.3527, 0.0002, 1, 0.67, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return lookup_property(prop_name, name, not negate, source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1457_C0", "label": "float_to_rational", "type": "function", "loc": [1457, 1466], "level": 0, "parent": null, "vector": [2, 0, 0.3543, 0.0024, 0, 0.66, 0.6218, 366, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "float_to_rational", "arg_names": ["flt"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def float_to_rational(flt):\n \"Converts a float to a rational pair.\"\n int_part = int(flt)\n error = flt - int_part\n if abs(error) < 0.0001:\n return int_part, 1\n\n den, num = float_to_rational(1.0 / error)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1458_C4", "label": "expression", "type": "expression", "loc": [1458, 1458], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1457_C0", "vector": [8, 1, 0.3535, 0.0002, 1, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Converts a float to a rational pair.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1459_C4", "label": "int_part = int()", "type": "assigned_variable", "loc": [1459, 1459], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1457_C0", "vector": [14, 1, 0.3537, 0.0002, 1, 0.94, 0.2, 429, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "int_part", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " int_part = int(flt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1460_C4", "label": "error =", "type": "assigned_variable", "loc": [1460, 1460], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1457_C0", "vector": [14, 1, 0.3539, 0.0002, 1, 0.94, 0.4, 771, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " error = flt - int_part"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1461_C4", "label": "if", "type": "if", "loc": [1461, 1462], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1457_C0", "vector": [4, 1, 0.3543, 0.0005, 1, 0.94, 0.6, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if abs(error) < 0.0001:\n return int_part, 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1462_C8", "label": "return", "type": "return", "loc": [1462, 1462], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1461_C4", "vector": [13, 2, 0.3544, 0.0002, 2, 0.95, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return int_part, 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1464_C4", "label": "den, num = float_to_rational()", "type": "assigned_variable", "loc": [1464, 1464], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1457_C0", "vector": [14, 1, 0.3549, 0.0002, 1, 0.94, 0.8, 72, 3, 1, 0, 0, 366, 10, 1], "semantic": {"name": "den, num", "arg_names": [], "import_names": [], "rhs_call_name": "float_to_rational", "annotation": ""}, "snippet": " den, num = float_to_rational(1.0 / error)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1466_C4", "label": "return", "type": "return", "loc": [1466, 1466], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1457_C0", "vector": [13, 1, 0.3554, 0.0002, 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 int_part * den + num, den"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1468_C0", "label": "numeric_to_rational", "type": "function", "loc": [1468, 1487], "level": 0, "parent": null, "vector": [2, 0, 0.3582, 0.0048, 0, 0.66, 0.6269, 874, 0, 1, 1, 0, 0, 0, 11], "semantic": {"name": "numeric_to_rational", "arg_names": ["numeric"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def numeric_to_rational(numeric):\n \"Converts a numeric string to a rational string, if possible.\"\n if numeric[ : 1] == \"-\":\n sign, numeric = numeric[0], numeric[1 : ]\n else:\n sign = \"\"\n\n parts = numeric.split(\"/\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1469_C4", "label": "expression", "type": "expression", "loc": [1469, 1469], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1468_C0", "vector": [8, 1, 0.3561, 0.0002, 1, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Converts a numeric string to a rational string, if possible.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1470_C4", "label": "if", "type": "if", "loc": [1470, 1473], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1468_C0", "vector": [4, 1, 0.3567, 0.001, 1, 0.25, 0.1667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if numeric[ : 1] == \"-\":\n sign, numeric = numeric[0], numeric[1 : ]\n else:\n sign = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1471_C8", "label": "sign, numeric =", "type": "assigned_variable", "loc": [1471, 1471], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1470_C4", "vector": [14, 2, 0.3566, 0.0002, 2, 0.48, 0.0, 336, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "sign, numeric", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sign, numeric = numeric[0], numeric[1 : ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1473_C8", "label": "sign =", "type": "assigned_variable", "loc": [1473, 1473], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1470_C4", "vector": [14, 2, 0.3571, 0.0002, 2, 0.48, 1.0, 448, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sign", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sign = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1475_C4", "label": "parts = split()", "type": "assigned_variable", "loc": [1475, 1475], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1468_C0", "vector": [14, 1, 0.3576, 0.0002, 1, 0.25, 0.3333, 13, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "parts", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " parts = numeric.split(\"/\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1476_C4", "label": "if", "type": "if", "loc": [1476, 1481], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1468_C0", "vector": [4, 1, 0.3584, 0.0015, 1, 0.25, 0.5, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(parts) == 2:\n num, den = float_to_rational(float(parts[0]) / float(parts[1]))\n elif len(parts) == 1:\n num, den = float_to_rational(float(parts[0]))\n else:\n raise ValueError()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1477_C8", "label": "num, den = float_to_rational()", "type": "assigned_variable", "loc": [1477, 1477], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1476_C4", "vector": [14, 2, 0.3581, 0.0002, 2, 0.3, 0.0, 865, 3, 1, 0, 0, 366, 10, 3], "semantic": {"name": "num, den", "arg_names": [], "import_names": [], "rhs_call_name": "float_to_rational", "annotation": ""}, "snippet": " num, den = float_to_rational(float(parts[0]) / float(parts[1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1478_C4", "label": "if", "type": "if", "loc": [1478, 1481], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1476_C4", "vector": [4, 2, 0.3587, 0.001, 2, 0.3, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(parts) == 1:\n num, den = float_to_rational(float(parts[0]))\n else:\n raise ValueError()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1479_C8", "label": "num, den = float_to_rational()", "type": "assigned_variable", "loc": [1479, 1479], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1478_C4", "vector": [14, 3, 0.3585, 0.0002, 3, 0.02, 0.0, 865, 3, 1, 0, 0, 366, 10, 2], "semantic": {"name": "num, den", "arg_names": [], "import_names": [], "rhs_call_name": "float_to_rational", "annotation": ""}, "snippet": " num, den = float_to_rational(float(parts[0]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1483_C4", "label": "result = format()", "type": "assigned_variable", "loc": [1483, 1483], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1468_C0", "vector": [14, 1, 0.3595, 0.0002, 1, 0.25, 0.6667, 51, 3, 3, 0, 0, 293, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "format", "annotation": ""}, "snippet": " result = \"{}{}/{}\".format(sign, num, den)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1484_C4", "label": "if", "type": "if", "loc": [1484, 1485], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1468_C0", "vector": [4, 1, 0.3599, 0.0005, 1, 0.25, 0.8333, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if result.endswith(\"/1\"):\n return result[ : -2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1485_C8", "label": "return", "type": "return", "loc": [1485, 1485], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1484_C4", "vector": [13, 2, 0.36, 0.0002, 2, 0.95, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result[ : -2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1487_C4", "label": "return", "type": "return", "loc": [1487, 1487], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1468_C0", "vector": [13, 1, 0.3605, 0.0002, 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 result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1489_C0", "label": "standardise_name", "type": "function", "loc": [1489, 1494], "level": 0, "parent": null, "vector": [2, 0, 0.3616, 0.0015, 0, 0.66, 0.6321, 189, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "standardise_name", "arg_names": ["name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def standardise_name(name):\n \"Standardises a property or value name.\"\n try:\n return numeric_to_rational(\"\".join(name))\n except (ValueError, ZeroDivisionError):\n return \"\".join(ch for ch in name if ch not in \"_- \").upper()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1490_C4", "label": "expression", "type": "expression", "loc": [1490, 1490], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1489_C0", "vector": [8, 1, 0.3612, 0.0002, 1, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Standardises a property or value name.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1491_C4", "label": "try", "type": "try", "loc": [1491, 1494], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1489_C0", "vector": [7, 1, 0.3618, 0.001, 1, 0.24, 1.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return numeric_to_rational(\"\".join(name))\n except (ValueError, ZeroDivisionError):\n return \"\".join(ch for ch in name if ch not in \"_- \").upper()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1492_C8", "label": "return", "type": "return", "loc": [1492, 1492], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1491_C4", "vector": [13, 2, 0.3617, 0.0002, 2, 0.54, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return numeric_to_rational(\"\".join(name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1494_C8", "label": "return", "type": "return", "loc": [1494, 1494], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1491_C4", "vector": [13, 2, 0.3622, 0.0002, 2, 0.54, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"\".join(ch for ch in name if ch not in \"_- \").upper()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "label": "lookup_property", "type": "function", "loc": [1496, 1563], "level": 0, "parent": null, "vector": [2, 0, 0.3708, 0.0165, 0, 0.66, 0.6373, 450, 0, 4, 1, 0, 0, 0, 23], "semantic": {"name": "lookup_property", "arg_names": ["property", "value", "positive", "source"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def lookup_property(property, value, positive, source=None):\n \"Looks up a property.\"\n # Normalise the names (which may still be lists).\n property = standardise_name(property) if property else None\n value = standardise_name(value)\n\n if (property, value) == (\"GENERALCATEGORY\", \"ASSIGNED\"):\n property, value, positive = \"GENERALCATEGORY\", \"UNASSIGNED\", not positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1497_C4", "label": "expression", "type": "expression", "loc": [1497, 1497], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "vector": [8, 1, 0.3629, 0.0002, 1, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Looks up a property.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1499_C4", "label": "property =", "type": "assigned_variable", "loc": [1499, 1499], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "vector": [14, 1, 0.3634, 0.0002, 1, 0.86, 0.1, 244, 8, 0, 0, 0, 0, 0, 1], "semantic": {"name": "property", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " property = standardise_name(property) if property else None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1500_C4", "label": "value = standardise_name()", "type": "assigned_variable", "loc": [1500, 1500], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "vector": [14, 1, 0.3636, 0.0002, 1, 0.86, 0.2, 441, 3, 1, 0, 0, 189, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "standardise_name", "annotation": ""}, "snippet": " value = standardise_name(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1502_C4", "label": "if", "type": "if", "loc": [1502, 1503], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "vector": [4, 1, 0.3642, 0.0005, 1, 0.86, 0.3, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (property, value) == (\"GENERALCATEGORY\", \"ASSIGNED\"):\n property, value, positive = \"GENERALCATEGORY\", \"UNASSIGNED\", not positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1503_C8", "label": "property, value, positive =", "type": "assigned_variable", "loc": [1503, 1503], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1502_C4", "vector": [14, 2, 0.3644, 0.0002, 2, 0.55, 0.0, 729, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "property, value, positive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " property, value, positive = \"GENERALCATEGORY\", \"UNASSIGNED\", not positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1505_C4", "label": "if", "type": "if", "loc": [1505, 1525], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "vector": [4, 1, 0.3673, 0.0051, 1, 0.86, 0.4, 0, 2, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if property:\n # Both the property and the value are provided.\n prop = PROPERTIES.get(property)\n if not prop:\n if not source:\n raise error(\"unknown property\")\n\n raise error(\"unknown property\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1507_C8", "label": "prop = get()", "type": "assigned_variable", "loc": [1507, 1507], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1505_C4", "vector": [14, 2, 0.3653, 0.0002, 2, 0.0, 0.0, 17, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "prop", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " prop = PROPERTIES.get(property)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1508_C8", "label": "if", "type": "if", "loc": [1508, 1512], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1505_C4", "vector": [4, 2, 0.3661, 0.0012, 2, 0.0, 0.1667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not prop:\n if not source:\n raise error(\"unknown property\")\n\n raise error(\"unknown property\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1509_C12", "label": "if", "type": "if", "loc": [1509, 1510], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1508_C8", "vector": [4, 3, 0.3659, 0.0005, 3, 0.49, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not source:\n raise error(\"unknown property\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1514_C8", "label": "prop_id, value_dict =", "type": "assigned_variable", "loc": [1514, 1514], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1505_C4", "vector": [14, 2, 0.367, 0.0002, 2, 0.0, 0.3333, 903, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prop_id, value_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prop_id, value_dict = prop"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1515_C8", "label": "val_id = get()", "type": "assigned_variable", "loc": [1515, 1515], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1505_C4", "vector": [14, 2, 0.3673, 0.0002, 2, 0.0, 0.5, 876, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "val_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " val_id = value_dict.get(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1516_C8", "label": "if", "type": "if", "loc": [1516, 1520], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1505_C4", "vector": [4, 2, 0.368, 0.0012, 2, 0.0, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if val_id is None:\n if not source:\n raise error(\"unknown property value\")\n\n raise error(\"unknown property value\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1517_C12", "label": "if", "type": "if", "loc": [1517, 1518], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1516_C8", "vector": [4, 3, 0.3679, 0.0005, 3, 0.55, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not source:\n raise error(\"unknown property value\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1522_C8", "label": "if", "type": "if", "loc": [1522, 1523], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1505_C4", "vector": [4, 2, 0.3691, 0.0005, 2, 0.0, 0.8333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if \"YES\" in value_dict and val_id == 0:\n positive, val_id = not positive, 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1523_C12", "label": "positive, val_id =", "type": "assigned_variable", "loc": [1523, 1523], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1522_C8", "vector": [14, 3, 0.3692, 0.0002, 3, 0.72, 0.0, 833, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "positive, val_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " positive, val_id = not positive, 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1525_C8", "label": "return", "type": "return", "loc": [1525, 1525], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1505_C4", "vector": [13, 2, 0.3697, 0.0002, 2, 0.0, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Property((prop_id << 16) | val_id, positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1529_C4", "label": "for property", "type": "for", "loc": [1529, 1533], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "vector": [6, 1, 0.3712, 0.0012, 1, 0.86, 0.5, 244, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "property", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for property in (\"GC\", \"SCRIPT\", \"BLOCK\"):\n prop_id, value_dict = PROPERTIES.get(property)\n val_id = value_dict.get(value)\n if val_id is not None:\n return Property((prop_id << 16) | val_id, positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1530_C8", "label": "prop_id, value_dict = get()", "type": "assigned_variable", "loc": [1530, 1530], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1529_C4", "vector": [14, 2, 0.3709, 0.0002, 2, 0.12, 0.0, 903, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "prop_id, value_dict", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " prop_id, value_dict = PROPERTIES.get(property)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1531_C8", "label": "val_id = get()", "type": "assigned_variable", "loc": [1531, 1531], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1529_C4", "vector": [14, 2, 0.3712, 0.0002, 2, 0.12, 0.5, 876, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "val_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " val_id = value_dict.get(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1532_C8", "label": "if", "type": "if", "loc": [1532, 1533], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1529_C4", "vector": [4, 2, 0.3715, 0.0005, 2, 0.12, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if val_id is not None:\n return Property((prop_id << 16) | val_id, positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1533_C12", "label": "return", "type": "return", "loc": [1533, 1533], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1532_C8", "vector": [13, 3, 0.3716, 0.0002, 3, 0.74, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Property((prop_id << 16) | val_id, positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1536_C4", "label": "prop = get()", "type": "assigned_variable", "loc": [1536, 1536], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "vector": [14, 1, 0.3724, 0.0002, 1, 0.86, 0.6, 17, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "prop", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " prop = PROPERTIES.get(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1537_C4", "label": "if", "type": "if", "loc": [1537, 1541], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "vector": [4, 1, 0.3731, 0.0012, 1, 0.86, 0.7, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if prop:\n prop_id, value_dict = prop\n\n if \"YES\" in value_dict:\n return Property((prop_id << 16) | 1, positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1538_C8", "label": "prop_id, value_dict =", "type": "assigned_variable", "loc": [1538, 1538], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1537_C4", "vector": [14, 2, 0.3728, 0.0002, 2, 0.46, 0.0, 903, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prop_id, value_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prop_id, value_dict = prop"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1540_C8", "label": "if", "type": "if", "loc": [1540, 1541], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1537_C4", "vector": [4, 2, 0.3735, 0.0005, 2, 0.46, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if \"YES\" in value_dict:\n return Property((prop_id << 16) | 1, positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1541_C12", "label": "return", "type": "return", "loc": [1541, 1541], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1540_C8", "vector": [13, 3, 0.3736, 0.0002, 3, 0.9, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Property((prop_id << 16) | 1, positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1544_C4", "label": "if", "type": "if", "loc": [1544, 1549], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "vector": [4, 1, 0.3749, 0.0015, 1, 0.86, 0.8, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value.startswith(\"IS\"):\n prop = PROPERTIES.get(value[2 : ])\n if prop:\n prop_id, value_dict = prop\n if \"YES\" in value_dict:\n return Property((prop_id << 16) | 1, positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1545_C8", "label": "prop = get()", "type": "assigned_variable", "loc": [1545, 1545], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1544_C4", "vector": [14, 2, 0.3745, 0.0002, 2, 0.79, 0.0, 17, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "prop", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " prop = PROPERTIES.get(value[2 : ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1546_C8", "label": "if", "type": "if", "loc": [1546, 1549], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1544_C4", "vector": [4, 2, 0.3752, 0.001, 2, 0.79, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if prop:\n prop_id, value_dict = prop\n if \"YES\" in value_dict:\n return Property((prop_id << 16) | 1, positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1547_C12", "label": "prop_id, value_dict =", "type": "assigned_variable", "loc": [1547, 1547], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1546_C8", "vector": [14, 3, 0.375, 0.0002, 3, 0.52, 0.0, 903, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prop_id, value_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prop_id, value_dict = prop"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1548_C12", "label": "if", "type": "if", "loc": [1548, 1549], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1546_C8", "vector": [4, 3, 0.3754, 0.0005, 3, 0.52, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if \"YES\" in value_dict:\n return Property((prop_id << 16) | 1, positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1549_C16", "label": "return", "type": "return", "loc": [1549, 1549], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1548_C12", "vector": [13, 4, 0.3755, 0.0002, 4, 0.0, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Property((prop_id << 16) | 1, positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1552_C4", "label": "for prefix, property", "type": "for", "loc": [1552, 1557], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "vector": [6, 1, 0.3768, 0.0015, 1, 0.86, 0.9, 392, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "prefix, property", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for prefix, property in ((\"IS\", \"SCRIPT\"), (\"IN\", \"BLOCK\")):\n if value.startswith(prefix):\n prop_id, value_dict = PROPERTIES.get(property)\n val_id = value_dict.get(value[2 : ])\n if val_id is not None:\n return Property((prop_id << 16) | val_id, positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1553_C8", "label": "if", "type": "if", "loc": [1553, 1557], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1552_C4", "vector": [4, 2, 0.377, 0.0012, 2, 0.09, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value.startswith(prefix):\n prop_id, value_dict = PROPERTIES.get(property)\n val_id = value_dict.get(value[2 : ])\n if val_id is not None:\n return Property((prop_id << 16) | val_id, positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1554_C12", "label": "prop_id, value_dict = get()", "type": "assigned_variable", "loc": [1554, 1554], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1553_C8", "vector": [14, 3, 0.3767, 0.0002, 3, 0.66, 0.0, 903, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "prop_id, value_dict", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " prop_id, value_dict = PROPERTIES.get(property)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1555_C12", "label": "val_id = get()", "type": "assigned_variable", "loc": [1555, 1555], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1553_C8", "vector": [14, 3, 0.377, 0.0002, 3, 0.66, 0.5, 876, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "val_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " val_id = value_dict.get(value[2 : ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1556_C12", "label": "if", "type": "if", "loc": [1556, 1557], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1553_C8", "vector": [4, 3, 0.3773, 0.0005, 3, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if val_id is not None:\n return Property((prop_id << 16) | val_id, positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1557_C16", "label": "return", "type": "return", "loc": [1557, 1557], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1556_C12", "vector": [13, 4, 0.3775, 0.0002, 4, 0.24, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Property((prop_id << 16) | val_id, positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1560_C4", "label": "if", "type": "if", "loc": [1560, 1561], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "vector": [4, 1, 0.3783, 0.0005, 1, 0.86, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not source:\n raise error(\"unknown property\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1565_C0", "label": "_compile_replacement", "type": "function", "loc": [1565, 1635], "level": 0, "parent": null, "vector": [2, 0, 0.3879, 0.0172, 0, 0.66, 0.6425, 693, 0, 3, 1, 0, 0, 0, 21], "semantic": {"name": "_compile_replacement", "arg_names": ["source", "pattern", "is_unicode"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _compile_replacement(source, pattern, is_unicode):\n \"Compiles a replacement template escape sequence.\"\n ch = source.get()\n if ch in ALPHA:\n # An alphabetic escape sequence.\n value = CHARACTER_ESCAPES.get(ch)\n if value:\n return False, [ord(value)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1566_C4", "label": "expression", "type": "expression", "loc": [1566, 1566], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1565_C0", "vector": [8, 1, 0.3796, 0.0002, 1, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Compiles a replacement template escape sequence.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1567_C4", "label": "ch = get()", "type": "assigned_variable", "loc": [1567, 1567], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1565_C0", "vector": [14, 1, 0.3799, 0.0002, 1, 0.99, 0.125, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1568_C4", "label": "if", "type": "if", "loc": [1568, 1588], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1565_C0", "vector": [4, 1, 0.3825, 0.0051, 1, 0.99, 0.25, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch in ALPHA:\n # An alphabetic escape sequence.\n value = CHARACTER_ESCAPES.get(ch)\n if value:\n return False, [ord(value)]\n\n if ch in HEX_ESCAPES and (ch == \"x\" or is_unicode):\n # A hexadecimal escape sequence."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1570_C8", "label": "value = get()", "type": "assigned_variable", "loc": [1570, 1570], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1568_C4", "vector": [14, 2, 0.3806, 0.0002, 2, 0.81, 0.0, 441, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " value = CHARACTER_ESCAPES.get(ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1571_C8", "label": "if", "type": "if", "loc": [1571, 1572], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1568_C4", "vector": [4, 2, 0.381, 0.0005, 2, 0.81, 0.2, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value:\n return False, [ord(value)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1572_C12", "label": "return", "type": "return", "loc": [1572, 1572], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1571_C8", "vector": [13, 3, 0.3811, 0.0002, 3, 0.62, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False, [ord(value)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1574_C8", "label": "if", "type": "if", "loc": [1574, 1576], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1568_C4", "vector": [4, 2, 0.3818, 0.0007, 2, 0.81, 0.4, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch in HEX_ESCAPES and (ch == \"x\" or is_unicode):\n # A hexadecimal escape sequence.\n return False, [parse_repl_hex_escape(source, HEX_ESCAPES[ch])]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1576_C12", "label": "return", "type": "return", "loc": [1576, 1576], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1574_C8", "vector": [13, 3, 0.3821, 0.0002, 3, 0.94, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False, [parse_repl_hex_escape(source, HEX_ESCAPES[ch])]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1578_C8", "label": "if", "type": "if", "loc": [1578, 1580], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1568_C4", "vector": [4, 2, 0.3828, 0.0007, 2, 0.81, 0.6, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"g\":\n # A group preference.\n return True, [compile_repl_group(source, pattern)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1580_C12", "label": "return", "type": "return", "loc": [1580, 1580], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1578_C8", "vector": [13, 3, 0.383, 0.0002, 3, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True, [compile_repl_group(source, pattern)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1582_C8", "label": "if", "type": "if", "loc": [1582, 1586], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1568_C4", "vector": [4, 2, 0.384, 0.0012, 2, 0.81, 0.8, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"N\" and is_unicode:\n # A named character.\n value = parse_repl_named_char(source)\n if value is not None:\n return False, [value]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1584_C12", "label": "value = parse_repl_named_char()", "type": "assigned_variable", "loc": [1584, 1584], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1582_C8", "vector": [14, 3, 0.384, 0.0002, 3, 0.27, 0.0, 441, 3, 1, 0, 0, 854, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "parse_repl_named_char", "annotation": ""}, "snippet": " value = parse_repl_named_char(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1585_C12", "label": "if", "type": "if", "loc": [1585, 1586], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1582_C8", "vector": [4, 3, 0.3844, 0.0005, 3, 0.27, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value is not None:\n return False, [value]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1586_C16", "label": "return", "type": "return", "loc": [1586, 1586], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1585_C12", "vector": [13, 4, 0.3845, 0.0002, 4, 0.41, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False, [value]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1588_C8", "label": "return", "type": "return", "loc": [1588, 1588], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1568_C4", "vector": [13, 2, 0.385, 0.0002, 2, 0.81, 1.0, 0, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False, [ord(\"\\\\\"), ord(ch)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1590_C4", "label": "if", "type": "if", "loc": [1590, 1593], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1565_C0", "vector": [4, 1, 0.3858, 0.001, 1, 0.99, 0.375, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(source.sep, bytes):\n octal_mask = 0xFF\n else:\n octal_mask = 0x1FF"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1591_C8", "label": "octal_mask =", "type": "assigned_variable", "loc": [1591, 1591], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1590_C4", "vector": [14, 2, 0.3857, 0.0002, 2, 0.41, 0.0, 172, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "octal_mask", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " octal_mask = 0xFF"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1593_C8", "label": "octal_mask =", "type": "assigned_variable", "loc": [1593, 1593], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1590_C4", "vector": [14, 2, 0.3862, 0.0002, 2, 0.41, 1.0, 172, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "octal_mask", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " octal_mask = 0x1FF"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1595_C4", "label": "if", "type": "if", "loc": [1595, 1606], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1565_C0", "vector": [4, 1, 0.388, 0.0029, 1, 0.99, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"0\":\n # An octal escape sequence.\n digits = ch\n while len(digits) < 3:\n saved_pos = source.pos\n ch = source.get()\n if ch not in OCT_DIGITS:\n source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1597_C8", "label": "digits =", "type": "assigned_variable", "loc": [1597, 1597], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1595_C4", "vector": [14, 2, 0.3872, 0.0002, 2, 0.99, 0.0, 400, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "digits", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " digits = ch"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1598_C8", "label": "while", "type": "while", "loc": [1598, 1604], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1595_C4", "vector": [5, 2, 0.3881, 0.0017, 2, 0.99, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while len(digits) < 3:\n saved_pos = source.pos\n ch = source.get()\n if ch not in OCT_DIGITS:\n source.pos = saved_pos\n break\n digits += ch"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1599_C12", "label": "saved_pos =", "type": "assigned_variable", "loc": [1599, 1599], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1598_C8", "vector": [14, 3, 0.3876, 0.0002, 3, 0.6, 0.0, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1600_C12", "label": "ch = get()", "type": "assigned_variable", "loc": [1600, 1600], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1598_C8", "vector": [14, 3, 0.3879, 0.0002, 3, 0.6, 0.5, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1601_C12", "label": "if", "type": "if", "loc": [1601, 1603], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1598_C8", "vector": [4, 3, 0.3884, 0.0007, 3, 0.6, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch not in OCT_DIGITS:\n source.pos = saved_pos\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1602_C16", "label": "source.pos =", "type": "assigned_variable", "loc": [1602, 1602], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1601_C12", "vector": [14, 4, 0.3884, 0.0002, 4, 0.95, 0.0, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1606_C8", "label": "return", "type": "return", "loc": [1606, 1606], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1595_C4", "vector": [13, 2, 0.3893, 0.0002, 2, 0.99, 1.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False, [int(digits, 8) & octal_mask]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1608_C4", "label": "if", "type": "if", "loc": [1608, 1624], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1565_C0", "vector": [4, 1, 0.3918, 0.0041, 1, 0.99, 0.625, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch in DIGITS:\n # Either an octal escape sequence (3 digits) or a group reference (max\n # 2 digits).\n digits = ch\n saved_pos = source.pos\n ch = source.get()\n if ch in DIGITS:\n digits += ch"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1611_C8", "label": "digits =", "type": "assigned_variable", "loc": [1611, 1611], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1608_C4", "vector": [14, 2, 0.3905, 0.0002, 2, 0.56, 0.0, 400, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "digits", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " digits = ch"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1612_C8", "label": "saved_pos =", "type": "assigned_variable", "loc": [1612, 1612], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1608_C4", "vector": [14, 2, 0.3908, 0.0002, 2, 0.56, 0.2, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1613_C8", "label": "ch = get()", "type": "assigned_variable", "loc": [1613, 1613], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1608_C4", "vector": [14, 2, 0.391, 0.0002, 2, 0.56, 0.4, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1614_C8", "label": "if", "type": "if", "loc": [1614, 1620], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1608_C4", "vector": [4, 2, 0.392, 0.0017, 2, 0.56, 0.6, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch in DIGITS:\n digits += ch\n saved_pos = source.pos\n ch = source.get()\n if ch and is_octal(digits + ch):\n # An octal escape sequence.\n return False, [int(digits + ch, 8) & octal_mask]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1616_C12", "label": "saved_pos =", "type": "assigned_variable", "loc": [1616, 1616], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1614_C8", "vector": [14, 3, 0.3918, 0.0002, 3, 0.86, 0.0, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1617_C12", "label": "ch = get()", "type": "assigned_variable", "loc": [1617, 1617], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1614_C8", "vector": [14, 3, 0.392, 0.0002, 3, 0.86, 0.5, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1618_C12", "label": "if", "type": "if", "loc": [1618, 1620], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1614_C8", "vector": [4, 3, 0.3925, 0.0007, 3, 0.86, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch and is_octal(digits + ch):\n # An octal escape sequence.\n return False, [int(digits + ch, 8) & octal_mask]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1620_C16", "label": "return", "type": "return", "loc": [1620, 1620], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1618_C12", "vector": [13, 4, 0.3927, 0.0002, 4, 0.82, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False, [int(digits + ch, 8) & octal_mask]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1623_C8", "label": "source.pos =", "type": "assigned_variable", "loc": [1623, 1623], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1608_C4", "vector": [14, 2, 0.3935, 0.0002, 2, 0.56, 0.8, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1624_C8", "label": "return", "type": "return", "loc": [1624, 1624], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1608_C4", "vector": [13, 2, 0.3937, 0.0002, 2, 0.56, 1.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True, [int(digits)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1626_C4", "label": "if", "type": "if", "loc": [1626, 1628], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1565_C0", "vector": [4, 1, 0.3944, 0.0007, 1, 0.99, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"\\\\\":\n # An escaped backslash is a backslash.\n return False, [ord(\"\\\\\")]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1628_C8", "label": "return", "type": "return", "loc": [1628, 1628], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1626_C4", "vector": [13, 2, 0.3947, 0.0002, 2, 0.22, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False, [ord(\"\\\\\")]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1630_C4", "label": "if", "type": "if", "loc": [1630, 1632], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1565_C0", "vector": [4, 1, 0.3954, 0.0007, 1, 0.99, 0.875, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not ch:\n # A trailing backslash.\n raise error(\"bad escape\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1635_C4", "label": "return", "type": "return", "loc": [1635, 1635], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1565_C0", "vector": [13, 1, 0.3964, 0.0002, 1, 0.99, 1.0, 0, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False, [ord(\"\\\\\"), ord(ch)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1637_C0", "label": "parse_repl_hex_escape", "type": "function", "loc": [1637, 1646], "level": 0, "parent": null, "vector": [2, 0, 0.3979, 0.0024, 0, 0.66, 0.6477, 383, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "parse_repl_hex_escape", "arg_names": ["source", "expected_len"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_repl_hex_escape(source, expected_len):\n \"Parses a hex escape sequence in a replacement string.\"\n digits = []\n for i in range(expected_len):\n ch = source.get()\n if ch not in HEX_DIGITS:\n raise error(\"bad hex escape\", source.string, source.pos)\n digits.append(ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1638_C4", "label": "expression", "type": "expression", "loc": [1638, 1638], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1637_C0", "vector": [8, 1, 0.3971, 0.0002, 1, 0.96, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a hex escape sequence in a replacement string.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1639_C4", "label": "digits =", "type": "assigned_variable", "loc": [1639, 1639], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1637_C0", "vector": [14, 1, 0.3973, 0.0002, 1, 0.96, 0.3333, 400, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "digits", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " digits = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1640_C4", "label": "for i", "type": "for", "loc": [1640, 1644], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1637_C0", "vector": [6, 1, 0.3981, 0.0012, 1, 0.96, 0.6667, 826, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(expected_len):\n ch = source.get()\n if ch not in HEX_DIGITS:\n raise error(\"bad hex escape\", source.string, source.pos)\n digits.append(ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1641_C8", "label": "ch = get()", "type": "assigned_variable", "loc": [1641, 1641], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1640_C4", "vector": [14, 2, 0.3978, 0.0002, 2, 0.63, 0.0, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1642_C8", "label": "if", "type": "if", "loc": [1642, 1643], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1640_C4", "vector": [4, 2, 0.3982, 0.0005, 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 ch not in HEX_DIGITS:\n raise error(\"bad hex escape\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1644_C8", "label": "append()", "type": "expression", "loc": [1644, 1644], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1640_C4", "vector": [8, 2, 0.3985, 0.0002, 2, 0.63, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " digits.append(ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1646_C4", "label": "return", "type": "return", "loc": [1646, 1646], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1637_C0", "vector": [13, 1, 0.399, 0.0002, 1, 0.96, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return int(\"\".join(digits), 16)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1648_C0", "label": "parse_repl_named_char", "type": "function", "loc": [1648, 1663], "level": 0, "parent": null, "vector": [2, 0, 0.4013, 0.0039, 0, 0.66, 0.6528, 854, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "parse_repl_named_char", "arg_names": ["source"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_repl_named_char(source):\n \"Parses a named character in a replacement string.\"\n saved_pos = source.pos\n if source.match(\"{\"):\n name = source.get_while(ALPHA | set(\" \"))\n\n if source.match(\"}\"):\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1649_C4", "label": "expression", "type": "expression", "loc": [1649, 1649], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1648_C0", "vector": [8, 1, 0.3998, 0.0002, 1, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Parses a named character in a replacement string.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1650_C4", "label": "saved_pos =", "type": "assigned_variable", "loc": [1650, 1650], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1648_C0", "vector": [14, 1, 0.4, 0.0002, 1, 0.97, 0.25, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_pos = source.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1651_C4", "label": "if", "type": "if", "loc": [1651, 1660], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1648_C0", "vector": [4, 1, 0.4013, 0.0024, 1, 0.97, 0.5, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source.match(\"{\"):\n name = source.get_while(ALPHA | set(\" \"))\n\n if source.match(\"}\"):\n try:\n value = unicodedata.lookup(name)\n return ord(value)\n except KeyError:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1652_C8", "label": "name = get_while()", "type": "assigned_variable", "loc": [1652, 1652], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1651_C4", "vector": [14, 2, 0.4005, 0.0002, 2, 0.5, 0.0, 57, 3, 1, 0, 0, 729, 10, 2], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "get_while", "annotation": ""}, "snippet": " name = source.get_while(ALPHA | set(\" \"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1654_C8", "label": "if", "type": "if", "loc": [1654, 1660], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1651_C4", "vector": [4, 2, 0.4017, 0.0017, 2, 0.5, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source.match(\"}\"):\n try:\n value = unicodedata.lookup(name)\n return ord(value)\n except KeyError:\n raise error(\"undefined character name\", source.string,\n source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1655_C12", "label": "try", "type": "try", "loc": [1655, 1660], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1654_C8", "vector": [7, 3, 0.4018, 0.0015, 3, 0.18, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n value = unicodedata.lookup(name)\n return ord(value)\n except KeyError:\n raise error(\"undefined character name\", source.string,\n source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1656_C16", "label": "value = lookup()", "type": "assigned_variable", "loc": [1656, 1656], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1655_C12", "vector": [14, 4, 0.4015, 0.0002, 4, 0.91, 0.0, 441, 3, 1, 0, 0, 955, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "lookup", "annotation": ""}, "snippet": " value = unicodedata.lookup(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1657_C16", "label": "return", "type": "return", "loc": [1657, 1657], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1655_C12", "vector": [13, 4, 0.4017, 0.0002, 4, 0.91, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ord(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1662_C4", "label": "source.pos =", "type": "assigned_variable", "loc": [1662, 1662], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1648_C0", "vector": [14, 1, 0.4029, 0.0002, 1, 0.97, 0.75, 828, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source.pos = saved_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1663_C4", "label": "return", "type": "return", "loc": [1663, 1663], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1648_C0", "vector": [13, 1, 0.4032, 0.0002, 1, 0.97, 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_1389:FunctionDef_L1665_C0", "label": "compile_repl_group", "type": "function", "loc": [1665, 1681], "level": 0, "parent": null, "vector": [2, 0, 0.4056, 0.0041, 0, 0.66, 0.658, 475, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "compile_repl_group", "arg_names": ["source", "pattern"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def compile_repl_group(source, pattern):\n \"Compiles a replacement template group reference.\"\n source.expect(\"<\")\n name = parse_name(source, True, True)\n\n source.expect(\">\")\n if name.isdigit():\n index = int(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1666_C4", "label": "expression", "type": "expression", "loc": [1666, 1666], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1665_C0", "vector": [8, 1, 0.4039, 0.0002, 1, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Compiles a replacement template group reference.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1667_C4", "label": "expect()", "type": "expression", "loc": [1667, 1667], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1665_C0", "vector": [8, 1, 0.4041, 0.0002, 1, 0.0, 0.2, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\"<\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1668_C4", "label": "name = parse_name()", "type": "assigned_variable", "loc": [1668, 1668], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1665_C0", "vector": [14, 1, 0.4044, 0.0002, 1, 0.0, 0.4, 57, 3, 3, 0, 0, 382, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "parse_name", "annotation": ""}, "snippet": " name = parse_name(source, True, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1670_C4", "label": "expect()", "type": "expression", "loc": [1670, 1670], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1665_C0", "vector": [8, 1, 0.4048, 0.0002, 1, 0.0, 0.6, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "expect", "arg_names": [], "import_names": [], "rhs_call_name": "expect", "annotation": ""}, "snippet": " source.expect(\">\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1671_C4", "label": "if", "type": "if", "loc": [1671, 1676], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1665_C0", "vector": [4, 1, 0.4057, 0.0015, 1, 0.0, 0.8, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name.isdigit():\n index = int(name)\n if not 0 <= index <= pattern.groups:\n raise error(\"invalid group\", source.string, source.pos)\n\n return index"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1672_C8", "label": "index = int()", "type": "assigned_variable", "loc": [1672, 1672], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1671_C4", "vector": [14, 2, 0.4053, 0.0002, 2, 0.6, 0.0, 780, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " index = int(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1673_C8", "label": "if", "type": "if", "loc": [1673, 1674], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1671_C4", "vector": [4, 2, 0.4057, 0.0005, 2, 0.6, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not 0 <= index <= pattern.groups:\n raise error(\"invalid group\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1676_C8", "label": "return", "type": "return", "loc": [1676, 1676], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1671_C4", "vector": [13, 2, 0.4063, 0.0002, 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 index"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1678_C4", "label": "try", "type": "try", "loc": [1678, 1681], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1665_C0", "vector": [7, 1, 0.4072, 0.001, 1, 0.0, 1.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return pattern.groupindex[name]\n except KeyError:\n raise IndexError(\"unknown group\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1679_C8", "label": "return", "type": "return", "loc": [1679, 1679], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1678_C4", "vector": [13, 2, 0.407, 0.0002, 2, 0.22, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return pattern.groupindex[name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1686_C0", "label": "INDENT =", "type": "assigned_variable", "loc": [1686, 1686], "level": 0, "parent": null, "vector": [14, 0, 0.4087, 0.0002, 0, 0.66, 0.6632, 994, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "INDENT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "INDENT = \" \""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1687_C0", "label": "POSITIVE_OP =", "type": "assigned_variable", "loc": [1687, 1687], "level": 0, "parent": null, "vector": [14, 0, 0.409, 0.0002, 0, 0.66, 0.6684, 310, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "POSITIVE_OP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "POSITIVE_OP = 0x1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1688_C0", "label": "ZEROWIDTH_OP =", "type": "assigned_variable", "loc": [1688, 1688], "level": 0, "parent": null, "vector": [14, 0, 0.4092, 0.0002, 0, 0.66, 0.6736, 601, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "ZEROWIDTH_OP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ZEROWIDTH_OP = 0x2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1689_C0", "label": "FUZZY_OP =", "type": "assigned_variable", "loc": [1689, 1689], "level": 0, "parent": null, "vector": [14, 0, 0.4095, 0.0002, 0, 0.66, 0.6788, 853, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "FUZZY_OP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "FUZZY_OP = 0x4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1690_C0", "label": "REVERSE_OP =", "type": "assigned_variable", "loc": [1690, 1690], "level": 0, "parent": null, "vector": [14, 0, 0.4097, 0.0002, 0, 0.66, 0.6839, 919, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "REVERSE_OP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "REVERSE_OP = 0x8"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1691_C0", "label": "REQUIRED_OP =", "type": "assigned_variable", "loc": [1691, 1691], "level": 0, "parent": null, "vector": [14, 0, 0.4099, 0.0002, 0, 0.66, 0.6891, 791, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "REQUIRED_OP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "REQUIRED_OP = 0x10"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1693_C0", "label": "POS_TEXT =", "type": "assigned_variable", "loc": [1693, 1693], "level": 0, "parent": null, "vector": [14, 0, 0.4104, 0.0002, 0, 0.66, 0.6943, 54, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "POS_TEXT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "POS_TEXT = {False: \"NON-MATCH\", True: \"MATCH\"}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1694_C0", "label": "CASE_TEXT =", "type": "assigned_variable", "loc": [1694, 1695], "level": 0, "parent": null, "vector": [14, 0, 0.4108, 0.0005, 0, 0.66, 0.6995, 978, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "CASE_TEXT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "CASE_TEXT = {NOCASE: \"\", IGNORECASE: \" SIMPLE_IGNORE_CASE\", FULLCASE: \"\",\n FULLIGNORECASE: \" FULL_IGNORE_CASE\"}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1697_C0", "label": "make_sequence", "type": "function", "loc": [1697, 1700], "level": 0, "parent": null, "vector": [2, 0, 0.4118, 0.001, 0, 0.66, 0.7047, 770, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "make_sequence", "arg_names": ["items"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def make_sequence(items):\n if len(items) == 1:\n return items[0]\n return Sequence(items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1698_C4", "label": "if", "type": "if", "loc": [1698, 1699], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1697_C0", "vector": [4, 1, 0.4118, 0.0005, 1, 0.62, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(items) == 1:\n return items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1699_C8", "label": "return", "type": "return", "loc": [1699, 1699], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1698_C4", "vector": [13, 2, 0.4119, 0.0002, 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 items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1700_C4", "label": "return", "type": "return", "loc": [1700, 1700], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1697_C0", "vector": [13, 1, 0.4121, 0.0002, 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 Sequence(items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "label": "RegexBase", "type": "class", "loc": [1703, 1773], "level": 0, "parent": null, "vector": [3, 0, 0.4213, 0.0172, 0, 0.66, 0.7098, 852, 0, 18, 0, 0, 0, 0, 11], "semantic": {"name": "RegexBase", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RegexBase:\n def __init__(self):\n self._key = self.__class__\n\n def with_flags(self, positive=None, case_flags=None, zerowidth=None):\n if positive is None:\n positive = self.positive\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1704_C4", "label": "__init__", "type": "function", "loc": [1704, 1705], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "vector": [2, 1, 0.4132, 0.0005, 1, 0.29, 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._key = self.__class__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1705_C8", "label": "self._key =", "type": "assigned_variable", "loc": [1705, 1705], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1704_C4", "vector": [14, 2, 0.4133, 0.0002, 2, 0.96, 0.0, 449, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._key = self.__class__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1707_C4", "label": "with_flags", "type": "function", "loc": [1707, 1725], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "vector": [2, 1, 0.416, 0.0046, 1, 0.29, 0.0588, 795, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "with_flags", "arg_names": ["self", "positive", "case_flags", "zerowidth"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def with_flags(self, positive=None, case_flags=None, zerowidth=None):\n if positive is None:\n positive = self.positive\n else:\n positive = bool(positive)\n if case_flags is None:\n case_flags = self.case_flags\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1708_C8", "label": "if", "type": "if", "loc": [1708, 1711], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1707_C4", "vector": [4, 2, 0.4144, 0.001, 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 positive is None:\n positive = self.positive\n else:\n positive = bool(positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1709_C12", "label": "positive =", "type": "assigned_variable", "loc": [1709, 1709], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1708_C8", "vector": [14, 3, 0.4143, 0.0002, 3, 0.43, 0.0, 568, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "positive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " positive = self.positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1711_C12", "label": "positive = bool()", "type": "assigned_variable", "loc": [1711, 1711], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1708_C8", "vector": [14, 3, 0.4148, 0.0002, 3, 0.43, 1.0, 568, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "positive", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " positive = bool(positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1712_C8", "label": "if", "type": "if", "loc": [1712, 1715], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1707_C4", "vector": [4, 2, 0.4154, 0.001, 2, 0.42, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if case_flags is None:\n case_flags = self.case_flags\n else:\n case_flags = case_flags & CASE_FLAGS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1713_C12", "label": "case_flags =", "type": "assigned_variable", "loc": [1713, 1713], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1712_C8", "vector": [14, 3, 0.4153, 0.0002, 3, 0.24, 0.0, 912, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "case_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " case_flags = self.case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1715_C12", "label": "case_flags =", "type": "assigned_variable", "loc": [1715, 1715], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1712_C8", "vector": [14, 3, 0.4158, 0.0002, 3, 0.24, 1.0, 912, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "case_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " case_flags = case_flags & CASE_FLAGS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1716_C8", "label": "if", "type": "if", "loc": [1716, 1719], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1707_C4", "vector": [4, 2, 0.4164, 0.001, 2, 0.42, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if zerowidth is None:\n zerowidth = self.zerowidth\n else:\n zerowidth = bool(zerowidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1717_C12", "label": "zerowidth =", "type": "assigned_variable", "loc": [1717, 1717], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1716_C8", "vector": [14, 3, 0.4162, 0.0002, 3, 0.69, 0.0, 628, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "zerowidth", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " zerowidth = self.zerowidth"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1719_C12", "label": "zerowidth = bool()", "type": "assigned_variable", "loc": [1719, 1719], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1716_C8", "vector": [14, 3, 0.4167, 0.0002, 3, 0.69, 1.0, 628, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "zerowidth", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " zerowidth = bool(zerowidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1721_C8", "label": "if", "type": "if", "loc": [1721, 1723], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1707_C4", "vector": [4, 2, 0.4175, 0.0007, 2, 0.42, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (positive == self.positive and case_flags == self.case_flags and\n zerowidth == self.zerowidth):\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1723_C12", "label": "return", "type": "return", "loc": [1723, 1723], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1721_C8", "vector": [13, 3, 0.4177, 0.0002, 3, 0.51, 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_1389:Return_L1725_C8", "label": "return", "type": "return", "loc": [1725, 1725], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1707_C4", "vector": [13, 2, 0.4182, 0.0002, 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.rebuild(positive, case_flags, zerowidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1727_C4", "label": "fix_groups", "type": "function", "loc": [1727, 1728], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "vector": [2, 1, 0.4188, 0.0005, 1, 0.29, 0.1176, 269, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "fix_groups", "arg_names": ["self", "pattern", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fix_groups(self, pattern, reverse, fuzzy):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1730_C4", "label": "optimise", "type": "function", "loc": [1730, 1731], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "vector": [2, 1, 0.4195, 0.0005, 1, 0.29, 0.1765, 265, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "optimise", "arg_names": ["self", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def optimise(self, info):\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1731_C8", "label": "return", "type": "return", "loc": [1731, 1731], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1730_C4", "vector": [13, 2, 0.4196, 0.0002, 2, 0.54, 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_1389:FunctionDef_L1733_C4", "label": "pack_characters", "type": "function", "loc": [1733, 1734], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "vector": [2, 1, 0.4202, 0.0005, 1, 0.29, 0.2353, 434, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "pack_characters", "arg_names": ["self", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pack_characters(self, info):\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1734_C8", "label": "return", "type": "return", "loc": [1734, 1734], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1733_C4", "vector": [13, 2, 0.4204, 0.0002, 2, 0.27, 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_1389:FunctionDef_L1736_C4", "label": "remove_captures", "type": "function", "loc": [1736, 1737], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "vector": [2, 1, 0.421, 0.0005, 1, 0.29, 0.2941, 732, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "remove_captures", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove_captures(self):\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1737_C8", "label": "return", "type": "return", "loc": [1737, 1737], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1736_C4", "vector": [13, 2, 0.4211, 0.0002, 2, 0.11, 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_1389:FunctionDef_L1739_C4", "label": "is_atomic", "type": "function", "loc": [1739, 1740], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "vector": [2, 1, 0.4217, 0.0005, 1, 0.29, 0.3529, 841, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "is_atomic", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_atomic(self):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1740_C8", "label": "return", "type": "return", "loc": [1740, 1740], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1739_C4", "vector": [13, 2, 0.4218, 0.0002, 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 True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1742_C4", "label": "can_be_affix", "type": "function", "loc": [1742, 1743], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "vector": [2, 1, 0.4224, 0.0005, 1, 0.29, 0.4118, 276, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "can_be_affix", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def can_be_affix(self):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1743_C8", "label": "return", "type": "return", "loc": [1743, 1743], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1742_C4", "vector": [13, 2, 0.4225, 0.0002, 2, 0.26, 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_1389:FunctionDef_L1745_C4", "label": "contains_group", "type": "function", "loc": [1745, 1746], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "vector": [2, 1, 0.4232, 0.0005, 1, 0.29, 0.4706, 206, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "contains_group", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def contains_group(self):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1746_C8", "label": "return", "type": "return", "loc": [1746, 1746], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1745_C4", "vector": [13, 2, 0.4233, 0.0002, 2, 0.02, 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_1389:FunctionDef_L1748_C4", "label": "get_firstset", "type": "function", "loc": [1748, 1749], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "vector": [2, 1, 0.4239, 0.0005, 1, 0.29, 0.5294, 638, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "get_firstset", "arg_names": ["self", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_firstset(self, reverse):\n raise _FirstSetError()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1751_C4", "label": "has_simple_start", "type": "function", "loc": [1751, 1752], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "vector": [2, 1, 0.4246, 0.0005, 1, 0.29, 0.5882, 317, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "has_simple_start", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def has_simple_start(self):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1752_C8", "label": "return", "type": "return", "loc": [1752, 1752], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1751_C4", "vector": [13, 2, 0.4247, 0.0002, 2, 0.56, 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_1389:FunctionDef_L1754_C4", "label": "compile", "type": "function", "loc": [1754, 1755], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "vector": [2, 1, 0.4253, 0.0005, 1, 0.29, 0.6471, 821, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def compile(self, reverse=False, fuzzy=False):\n return self._compile(reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1755_C8", "label": "return", "type": "return", "loc": [1755, 1755], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1754_C4", "vector": [13, 2, 0.4255, 0.0002, 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._compile(reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1757_C4", "label": "dump", "type": "function", "loc": [1757, 1758], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "vector": [2, 1, 0.4261, 0.0005, 1, 0.29, 0.7059, 952, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def dump(self, indent, reverse):\n self._dump(indent, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1758_C8", "label": "_dump()", "type": "expression", "loc": [1758, 1758], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1757_C4", "vector": [8, 2, 0.4262, 0.0002, 2, 0.31, 0.0, 656, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_dump", "arg_names": [], "import_names": [], "rhs_call_name": "_dump", "annotation": ""}, "snippet": " self._dump(indent, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1760_C4", "label": "is_empty", "type": "function", "loc": [1760, 1761], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "vector": [2, 1, 0.4268, 0.0005, 1, 0.29, 0.7647, 623, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "is_empty", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_empty(self):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1761_C8", "label": "return", "type": "return", "loc": [1761, 1761], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1760_C4", "vector": [13, 2, 0.4269, 0.0002, 2, 0.93, 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_1389:FunctionDef_L1763_C4", "label": "__hash__", "type": "function", "loc": [1763, 1764], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "vector": [2, 1, 0.4275, 0.0005, 1, 0.29, 0.8235, 49, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__hash__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __hash__(self):\n return hash(self._key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1764_C8", "label": "return", "type": "return", "loc": [1764, 1764], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1763_C4", "vector": [13, 2, 0.4276, 0.0002, 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 hash(self._key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1766_C4", "label": "__eq__", "type": "function", "loc": [1766, 1767], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "vector": [2, 1, 0.4282, 0.0005, 1, 0.29, 0.8824, 763, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n return type(self) is type(other) and self._key == other._key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1767_C8", "label": "return", "type": "return", "loc": [1767, 1767], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1766_C4", "vector": [13, 2, 0.4284, 0.0002, 2, 0.27, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return type(self) is type(other) and self._key == other._key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1769_C4", "label": "__ne__", "type": "function", "loc": [1769, 1770], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "vector": [2, 1, 0.429, 0.0005, 1, 0.29, 0.9412, 254, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__ne__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __ne__(self, other):\n return not self.__eq__(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1770_C8", "label": "return", "type": "return", "loc": [1770, 1770], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1769_C4", "vector": [13, 2, 0.4291, 0.0002, 2, 0.91, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return not self.__eq__(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1772_C4", "label": "get_required_string", "type": "function", "loc": [1772, 1773], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "vector": [2, 1, 0.4297, 0.0005, 1, 0.29, 1.0, 720, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_required_string", "arg_names": ["self", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_required_string(self, reverse):\n return self.max_width(), None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1773_C8", "label": "return", "type": "return", "loc": [1773, 1773], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1772_C4", "vector": [13, 2, 0.4298, 0.0002, 2, 0.99, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.max_width(), None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1776_C0", "label": "ZeroWidthBase", "type": "class", "loc": [1776, 1801], "level": 0, "parent": null, "vector": [3, 0, 0.4336, 0.0063, 0, 0.66, 0.715, 752, 0, 5, 0, 0, 852, 0, 5], "semantic": {"name": "ZeroWidthBase", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ZeroWidthBase(RegexBase):\n def __init__(self, positive=True):\n RegexBase.__init__(self)\n self.positive = bool(positive)\n\n self._key = self.__class__, self.positive\n\n def get_firstset(self, reverse):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1777_C4", "label": "__init__", "type": "function", "loc": [1777, 1781], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1776_C0", "vector": [2, 1, 0.4313, 0.0012, 1, 0.15, 0.0, 555, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "positive"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, positive=True):\n RegexBase.__init__(self)\n self.positive = bool(positive)\n\n self._key = self.__class__, self.positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1778_C8", "label": "__init__()", "type": "expression", "loc": [1778, 1778], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1777_C4", "vector": [8, 2, 0.431, 0.0002, 2, 0.9, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " RegexBase.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1779_C8", "label": "self.positive = bool()", "type": "assigned_variable", "loc": [1779, 1779], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1777_C4", "vector": [14, 2, 0.4313, 0.0002, 2, 0.9, 0.5, 226, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "self.positive", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " self.positive = bool(positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1781_C8", "label": "self._key =", "type": "assigned_variable", "loc": [1781, 1781], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1777_C4", "vector": [14, 2, 0.4318, 0.0002, 2, 0.9, 1.0, 449, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "self._key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._key = self.__class__, self.positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1783_C4", "label": "get_firstset", "type": "function", "loc": [1783, 1784], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1776_C0", "vector": [2, 1, 0.4324, 0.0005, 1, 0.15, 0.25, 638, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_firstset", "arg_names": ["self", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_firstset(self, reverse):\n return set([None])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1784_C8", "label": "return", "type": "return", "loc": [1784, 1784], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1783_C4", "vector": [13, 2, 0.4325, 0.0002, 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 set([None])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1786_C4", "label": "_compile", "type": "function", "loc": [1786, 1794], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1776_C0", "vector": [2, 1, 0.4339, 0.0022, 1, 0.15, 0.5, 779, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n flags = 0\n if self.positive:\n flags |= POSITIVE_OP\n if fuzzy:\n flags |= FUZZY_OP\n if reverse:\n flags |= REVERSE_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1787_C8", "label": "flags =", "type": "assigned_variable", "loc": [1787, 1787], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1786_C4", "vector": [14, 2, 0.4332, 0.0002, 2, 0.66, 0.0, 375, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " flags = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1788_C8", "label": "if", "type": "if", "loc": [1788, 1789], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1786_C4", "vector": [4, 2, 0.4336, 0.0005, 2, 0.66, 0.25, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.positive:\n flags |= POSITIVE_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1790_C8", "label": "if", "type": "if", "loc": [1790, 1791], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1786_C4", "vector": [4, 2, 0.4341, 0.0005, 2, 0.66, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if fuzzy:\n flags |= FUZZY_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1792_C8", "label": "if", "type": "if", "loc": [1792, 1793], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1786_C4", "vector": [4, 2, 0.4345, 0.0005, 2, 0.66, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if reverse:\n flags |= REVERSE_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1794_C8", "label": "return", "type": "return", "loc": [1794, 1794], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1786_C4", "vector": [13, 2, 0.4349, 0.0002, 2, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [(self._opcode, flags)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1796_C4", "label": "_dump", "type": "function", "loc": [1796, 1798], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1776_C0", "vector": [2, 1, 0.4356, 0.0007, 1, 0.15, 0.75, 656, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n print(\"{}{} {}\".format(INDENT * indent, self._op_name,\n POS_TEXT[self.positive]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1797_C8", "label": "print()", "type": "expression", "loc": [1797, 1798], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1796_C4", "vector": [8, 2, 0.4358, 0.0005, 2, 0.9, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}{} {}\".format(INDENT * indent, self._op_name,\n POS_TEXT[self.positive]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1800_C4", "label": "max_width", "type": "function", "loc": [1800, 1801], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1776_C0", "vector": [2, 1, 0.4365, 0.0005, 1, 0.15, 1.0, 0, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "max_width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_width(self):\n return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1801_C8", "label": "return", "type": "return", "loc": [1801, 1801], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1800_C4", "vector": [13, 2, 0.4366, 0.0002, 2, 0.85, 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_1389:ClassDef_L1803_C0", "label": "Any", "type": "class", "loc": [1803, 1820], "level": 0, "parent": null, "vector": [3, 0, 0.4392, 0.0044, 0, 0.66, 0.7202, 739, 0, 4, 0, 0, 852, 0, 2], "semantic": {"name": "Any", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Any(RegexBase):\n _opcode = {False: OP.ANY, True: OP.ANY_REV}\n _op_name = \"ANY\"\n\n def has_simple_start(self):\n return True\n\n def _compile(self, reverse, fuzzy):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1804_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [1804, 1804], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1803_C0", "vector": [14, 1, 0.4373, 0.0002, 1, 0.63, 0.0, 52, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = {False: OP.ANY, True: OP.ANY_REV}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1805_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [1805, 1805], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1803_C0", "vector": [14, 1, 0.4376, 0.0002, 1, 0.63, 0.2, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"ANY\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1807_C4", "label": "has_simple_start", "type": "function", "loc": [1807, 1808], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1803_C0", "vector": [2, 1, 0.4382, 0.0005, 1, 0.63, 0.4, 317, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "has_simple_start", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def has_simple_start(self):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1808_C8", "label": "return", "type": "return", "loc": [1808, 1808], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1807_C4", "vector": [13, 2, 0.4383, 0.0002, 2, 0.7, 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_1389:FunctionDef_L1810_C4", "label": "_compile", "type": "function", "loc": [1810, 1814], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1803_C0", "vector": [2, 1, 0.4393, 0.0012, 1, 0.63, 0.6, 779, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n flags = 0\n if fuzzy:\n flags |= FUZZY_OP\n return [(self._opcode[reverse], flags)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1811_C8", "label": "flags =", "type": "assigned_variable", "loc": [1811, 1811], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1810_C4", "vector": [14, 2, 0.439, 0.0002, 2, 0.82, 0.0, 375, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " flags = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1812_C8", "label": "if", "type": "if", "loc": [1812, 1813], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1810_C4", "vector": [4, 2, 0.4394, 0.0005, 2, 0.82, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if fuzzy:\n flags |= FUZZY_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1814_C8", "label": "return", "type": "return", "loc": [1814, 1814], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1810_C4", "vector": [13, 2, 0.4398, 0.0002, 2, 0.82, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [(self._opcode[reverse], flags)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1816_C4", "label": "_dump", "type": "function", "loc": [1816, 1817], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1803_C0", "vector": [2, 1, 0.4404, 0.0005, 1, 0.63, 0.8, 656, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n print(\"{}{}\".format(INDENT * indent, self._op_name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1817_C8", "label": "print()", "type": "expression", "loc": [1817, 1817], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1816_C4", "vector": [8, 2, 0.4405, 0.0002, 2, 0.48, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}{}\".format(INDENT * indent, self._op_name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1819_C4", "label": "max_width", "type": "function", "loc": [1819, 1820], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1803_C0", "vector": [2, 1, 0.4411, 0.0005, 1, 0.63, 1.0, 0, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "max_width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_width(self):\n return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1820_C8", "label": "return", "type": "return", "loc": [1820, 1820], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1819_C4", "vector": [13, 2, 0.4412, 0.0002, 2, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1822_C0", "label": "AnyAll", "type": "class", "loc": [1822, 1824], "level": 0, "parent": null, "vector": [3, 0, 0.4419, 0.0007, 0, 0.66, 0.7254, 871, 0, 0, 0, 0, 739, 0, 0], "semantic": {"name": "AnyAll", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class AnyAll(Any):\n _opcode = {False: OP.ANY_ALL, True: OP.ANY_ALL_REV}\n _op_name = \"ANY_ALL\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1823_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [1823, 1823], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1822_C0", "vector": [14, 1, 0.4419, 0.0002, 1, 0.3, 0.0, 52, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = {False: OP.ANY_ALL, True: OP.ANY_ALL_REV}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1824_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [1824, 1824], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1822_C0", "vector": [14, 1, 0.4422, 0.0002, 1, 0.3, 1.0, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"ANY_ALL\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1826_C0", "label": "AnyU", "type": "class", "loc": [1826, 1828], "level": 0, "parent": null, "vector": [3, 0, 0.4429, 0.0007, 0, 0.66, 0.7306, 710, 0, 0, 0, 0, 739, 0, 0], "semantic": {"name": "AnyU", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class AnyU(Any):\n _opcode = {False: OP.ANY_U, True: OP.ANY_U_REV}\n _op_name = \"ANY_U\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1827_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [1827, 1827], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1826_C0", "vector": [14, 1, 0.4429, 0.0002, 1, 0.32, 0.0, 52, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = {False: OP.ANY_U, True: OP.ANY_U_REV}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1828_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [1828, 1828], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1826_C0", "vector": [14, 1, 0.4432, 0.0002, 1, 0.32, 1.0, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"ANY_U\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "label": "Atomic", "type": "class", "loc": [1830, 1884], "level": 0, "parent": null, "vector": [3, 0, 0.4502, 0.0133, 0, 0.66, 0.7358, 16, 0, 15, 0, 0, 852, 0, 19], "semantic": {"name": "Atomic", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Atomic(RegexBase):\n def __init__(self, subpattern):\n RegexBase.__init__(self)\n self.subpattern = subpattern\n\n def fix_groups(self, pattern, reverse, fuzzy):\n self.subpattern.fix_groups(pattern, reverse, fuzzy)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1831_C4", "label": "__init__", "type": "function", "loc": [1831, 1833], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "vector": [2, 1, 0.4441, 0.0007, 1, 0.68, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "subpattern"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, subpattern):\n RegexBase.__init__(self)\n self.subpattern = subpattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1832_C8", "label": "__init__()", "type": "expression", "loc": [1832, 1832], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1831_C4", "vector": [8, 2, 0.4441, 0.0002, 2, 0.81, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " RegexBase.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1833_C8", "label": "self.subpattern =", "type": "assigned_variable", "loc": [1833, 1833], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1831_C4", "vector": [14, 2, 0.4444, 0.0002, 2, 0.81, 1.0, 131, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.subpattern = subpattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1835_C4", "label": "fix_groups", "type": "function", "loc": [1835, 1836], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "vector": [2, 1, 0.445, 0.0005, 1, 0.68, 0.0714, 269, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "fix_groups", "arg_names": ["self", "pattern", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fix_groups(self, pattern, reverse, fuzzy):\n self.subpattern.fix_groups(pattern, reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1836_C8", "label": "fix_groups()", "type": "expression", "loc": [1836, 1836], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1835_C4", "vector": [8, 2, 0.4451, 0.0002, 2, 0.59, 0.0, 269, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "fix_groups", "arg_names": [], "import_names": [], "rhs_call_name": "fix_groups", "annotation": ""}, "snippet": " self.subpattern.fix_groups(pattern, reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1838_C4", "label": "optimise", "type": "function", "loc": [1838, 1843], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "vector": [2, 1, 0.4462, 0.0015, 1, 0.68, 0.1429, 265, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "optimise", "arg_names": ["self", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def optimise(self, info):\n self.subpattern = self.subpattern.optimise(info)\n\n if self.subpattern.is_empty():\n return self.subpattern\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1839_C8", "label": "self.subpattern = optimise()", "type": "assigned_variable", "loc": [1839, 1839], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1838_C4", "vector": [14, 2, 0.4458, 0.0002, 2, 0.19, 0.0, 131, 3, 1, 0, 0, 265, 10, 1], "semantic": {"name": "self.subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "optimise", "annotation": ""}, "snippet": " self.subpattern = self.subpattern.optimise(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1841_C8", "label": "if", "type": "if", "loc": [1841, 1842], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1838_C4", "vector": [4, 2, 0.4464, 0.0005, 2, 0.19, 0.5, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.subpattern.is_empty():\n return self.subpattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1842_C12", "label": "return", "type": "return", "loc": [1842, 1842], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1841_C8", "vector": [13, 3, 0.4465, 0.0002, 3, 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.subpattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1843_C8", "label": "return", "type": "return", "loc": [1843, 1843], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1838_C4", "vector": [13, 2, 0.4468, 0.0002, 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 self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1845_C4", "label": "pack_characters", "type": "function", "loc": [1845, 1847], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "vector": [2, 1, 0.4475, 0.0007, 1, 0.68, 0.2143, 434, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "pack_characters", "arg_names": ["self", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pack_characters(self, info):\n self.subpattern = self.subpattern.pack_characters(info)\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1846_C8", "label": "self.subpattern = pack_characters()", "type": "assigned_variable", "loc": [1846, 1846], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1845_C4", "vector": [14, 2, 0.4475, 0.0002, 2, 0.06, 0.0, 131, 3, 1, 0, 0, 434, 10, 1], "semantic": {"name": "self.subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "pack_characters", "annotation": ""}, "snippet": " self.subpattern = self.subpattern.pack_characters(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1847_C8", "label": "return", "type": "return", "loc": [1847, 1847], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1845_C4", "vector": [13, 2, 0.4478, 0.0002, 2, 0.06, 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_1389:FunctionDef_L1849_C4", "label": "remove_captures", "type": "function", "loc": [1849, 1851], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "vector": [2, 1, 0.4485, 0.0007, 1, 0.68, 0.2857, 732, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "remove_captures", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove_captures(self):\n self.subpattern = self.subpattern.remove_captures()\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1850_C8", "label": "self.subpattern = remove_captures()", "type": "assigned_variable", "loc": [1850, 1850], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1849_C4", "vector": [14, 2, 0.4485, 0.0002, 2, 0.05, 0.0, 131, 3, 0, 0, 0, 732, 10, 1], "semantic": {"name": "self.subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "remove_captures", "annotation": ""}, "snippet": " self.subpattern = self.subpattern.remove_captures()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1851_C8", "label": "return", "type": "return", "loc": [1851, 1851], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1849_C4", "vector": [13, 2, 0.4487, 0.0002, 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 self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1853_C4", "label": "can_be_affix", "type": "function", "loc": [1853, 1854], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "vector": [2, 1, 0.4493, 0.0005, 1, 0.68, 0.3571, 276, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "can_be_affix", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def can_be_affix(self):\n return self.subpattern.can_be_affix()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1854_C8", "label": "return", "type": "return", "loc": [1854, 1854], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1853_C4", "vector": [13, 2, 0.4495, 0.0002, 2, 0.78, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.subpattern.can_be_affix()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1856_C4", "label": "contains_group", "type": "function", "loc": [1856, 1857], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "vector": [2, 1, 0.4501, 0.0005, 1, 0.68, 0.4286, 206, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "contains_group", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def contains_group(self):\n return self.subpattern.contains_group()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1857_C8", "label": "return", "type": "return", "loc": [1857, 1857], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1856_C4", "vector": [13, 2, 0.4502, 0.0002, 2, 0.98, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.subpattern.contains_group()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1859_C4", "label": "get_firstset", "type": "function", "loc": [1859, 1860], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "vector": [2, 1, 0.4508, 0.0005, 1, 0.68, 0.5, 638, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_firstset", "arg_names": ["self", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_firstset(self, reverse):\n return self.subpattern.get_firstset(reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1860_C8", "label": "return", "type": "return", "loc": [1860, 1860], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1859_C4", "vector": [13, 2, 0.4509, 0.0002, 2, 0.56, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.subpattern.get_firstset(reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1862_C4", "label": "has_simple_start", "type": "function", "loc": [1862, 1863], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "vector": [2, 1, 0.4515, 0.0005, 1, 0.68, 0.5714, 317, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "has_simple_start", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def has_simple_start(self):\n return self.subpattern.has_simple_start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1863_C8", "label": "return", "type": "return", "loc": [1863, 1863], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1862_C4", "vector": [13, 2, 0.4516, 0.0002, 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.subpattern.has_simple_start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1865_C4", "label": "_compile", "type": "function", "loc": [1865, 1867], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "vector": [2, 1, 0.4524, 0.0007, 1, 0.68, 0.6429, 779, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n return ([(OP.ATOMIC, )] + self.subpattern.compile(reverse, fuzzy) +\n [(OP.END, )])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1866_C8", "label": "return", "type": "return", "loc": [1866, 1867], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1865_C4", "vector": [13, 2, 0.4525, 0.0005, 2, 0.69, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ([(OP.ATOMIC, )] + self.subpattern.compile(reverse, fuzzy) +\n [(OP.END, )])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1869_C4", "label": "_dump", "type": "function", "loc": [1869, 1871], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "vector": [2, 1, 0.4533, 0.0007, 1, 0.68, 0.7143, 656, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n print(\"{}ATOMIC\".format(INDENT * indent))\n self.subpattern.dump(indent + 1, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1870_C8", "label": "print()", "type": "expression", "loc": [1870, 1870], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1869_C4", "vector": [8, 2, 0.4533, 0.0002, 2, 0.1, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}ATOMIC\".format(INDENT * indent))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1871_C8", "label": "dump()", "type": "expression", "loc": [1871, 1871], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1869_C4", "vector": [8, 2, 0.4536, 0.0002, 2, 0.1, 1.0, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " self.subpattern.dump(indent + 1, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1873_C4", "label": "is_empty", "type": "function", "loc": [1873, 1874], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "vector": [2, 1, 0.4542, 0.0005, 1, 0.68, 0.7857, 623, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "is_empty", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_empty(self):\n return self.subpattern.is_empty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1874_C8", "label": "return", "type": "return", "loc": [1874, 1874], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1873_C4", "vector": [13, 2, 0.4543, 0.0002, 2, 0.18, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.subpattern.is_empty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1876_C4", "label": "__eq__", "type": "function", "loc": [1876, 1878], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "vector": [2, 1, 0.455, 0.0007, 1, 0.68, 0.8571, 763, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n return (type(self) is type(other) and self.subpattern ==\n other.subpattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1877_C8", "label": "return", "type": "return", "loc": [1877, 1878], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1876_C4", "vector": [13, 2, 0.4552, 0.0005, 2, 0.77, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (type(self) is type(other) and self.subpattern ==\n other.subpattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1880_C4", "label": "max_width", "type": "function", "loc": [1880, 1881], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "vector": [2, 1, 0.4559, 0.0005, 1, 0.68, 0.9286, 0, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "max_width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_width(self):\n return self.subpattern.max_width()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1881_C8", "label": "return", "type": "return", "loc": [1881, 1881], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1880_C4", "vector": [13, 2, 0.456, 0.0002, 2, 0.52, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.subpattern.max_width()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1883_C4", "label": "get_required_string", "type": "function", "loc": [1883, 1884], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "vector": [2, 1, 0.4566, 0.0005, 1, 0.68, 1.0, 720, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_required_string", "arg_names": ["self", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_required_string(self, reverse):\n return self.subpattern.get_required_string(reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1884_C8", "label": "return", "type": "return", "loc": [1884, 1884], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1883_C4", "vector": [13, 2, 0.4567, 0.0002, 2, 0.19, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.subpattern.get_required_string(reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1886_C0", "label": "Boundary", "type": "class", "loc": [1886, 1888], "level": 0, "parent": null, "vector": [3, 0, 0.4575, 0.0007, 0, 0.66, 0.7409, 846, 0, 0, 0, 0, 752, 0, 0], "semantic": {"name": "Boundary", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Boundary(ZeroWidthBase):\n _opcode = OP.BOUNDARY\n _op_name = \"BOUNDARY\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1887_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [1887, 1887], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1886_C0", "vector": [14, 1, 0.4575, 0.0002, 1, 0.26, 0.0, 52, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = OP.BOUNDARY"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1888_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [1888, 1888], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1886_C0", "vector": [14, 1, 0.4577, 0.0002, 1, 0.26, 1.0, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"BOUNDARY\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "label": "Branch", "type": "class", "loc": [1890, 2262], "level": 0, "parent": null, "vector": [3, 0, 0.5033, 0.0904, 0, 0.66, 0.7461, 855, 0, 27, 0, 0, 852, 0, 99], "semantic": {"name": "Branch", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Branch(RegexBase):\n def __init__(self, branches):\n RegexBase.__init__(self)\n self.branches = branches\n\n def fix_groups(self, pattern, reverse, fuzzy):\n for b in self.branches:\n b.fix_groups(pattern, reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1891_C4", "label": "__init__", "type": "function", "loc": [1891, 1893], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.4587, 0.0007, 1, 0.61, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "branches"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, branches):\n RegexBase.__init__(self)\n self.branches = branches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1892_C8", "label": "__init__()", "type": "expression", "loc": [1892, 1892], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1891_C4", "vector": [8, 2, 0.4587, 0.0002, 2, 0.95, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " RegexBase.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1893_C8", "label": "self.branches =", "type": "assigned_variable", "loc": [1893, 1893], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1891_C4", "vector": [14, 2, 0.4589, 0.0002, 2, 0.95, 1.0, 267, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.branches", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.branches = branches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1895_C4", "label": "fix_groups", "type": "function", "loc": [1895, 1897], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.4596, 0.0007, 1, 0.61, 0.0385, 269, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "fix_groups", "arg_names": ["self", "pattern", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fix_groups(self, pattern, reverse, fuzzy):\n for b in self.branches:\n b.fix_groups(pattern, reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1896_C8", "label": "for b", "type": "for", "loc": [1896, 1897], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1895_C4", "vector": [6, 2, 0.4598, 0.0005, 2, 0.42, 0.0, 756, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for b in self.branches:\n b.fix_groups(pattern, reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1897_C12", "label": "fix_groups()", "type": "expression", "loc": [1897, 1897], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1896_C8", "vector": [8, 3, 0.4599, 0.0002, 3, 0.68, 0.0, 269, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "fix_groups", "arg_names": [], "import_names": [], "rhs_call_name": "fix_groups", "annotation": ""}, "snippet": " b.fix_groups(pattern, reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1899_C4", "label": "optimise", "type": "function", "loc": [1899, 1920], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.4629, 0.0053, 1, 0.61, 0.0769, 265, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "optimise", "arg_names": ["self", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def optimise(self, info):\n # Flatten branches within branches.\n branches = Branch._flatten_branches(info, self.branches)\n\n # Move any common prefix or suffix out of the branches.\n prefix, branches = Branch._split_common_prefix(info, branches)\n suffix, branches = Branch._split_common_suffix(info, branches)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1901_C8", "label": "branches = _flatten_branches()", "type": "assigned_variable", "loc": [1901, 1901], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1899_C4", "vector": [14, 2, 0.4608, 0.0002, 2, 0.88, 0.0, 286, 3, 2, 0, 0, 5, 10, 1], "semantic": {"name": "branches", "arg_names": [], "import_names": [], "rhs_call_name": "_flatten_branches", "annotation": ""}, "snippet": " branches = Branch._flatten_branches(info, self.branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1904_C8", "label": "prefix, branches = _split_common_prefix()", "type": "assigned_variable", "loc": [1904, 1904], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1899_C4", "vector": [14, 2, 0.4616, 0.0002, 2, 0.88, 0.1667, 523, 3, 2, 0, 0, 513, 10, 1], "semantic": {"name": "prefix, branches", "arg_names": [], "import_names": [], "rhs_call_name": "_split_common_prefix", "annotation": ""}, "snippet": " prefix, branches = Branch._split_common_prefix(info, branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1905_C8", "label": "suffix, branches = _split_common_suffix()", "type": "assigned_variable", "loc": [1905, 1905], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1899_C4", "vector": [14, 2, 0.4618, 0.0002, 2, 0.88, 0.3333, 24, 3, 2, 0, 0, 288, 10, 1], "semantic": {"name": "suffix, branches", "arg_names": [], "import_names": [], "rhs_call_name": "_split_common_suffix", "annotation": ""}, "snippet": " suffix, branches = Branch._split_common_suffix(info, branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1910_C8", "label": "branches = _merge_common_prefixes()", "type": "assigned_variable", "loc": [1910, 1910], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1899_C4", "vector": [14, 2, 0.463, 0.0002, 2, 0.88, 0.5, 286, 3, 2, 0, 0, 851, 10, 1], "semantic": {"name": "branches", "arg_names": [], "import_names": [], "rhs_call_name": "_merge_common_prefixes", "annotation": ""}, "snippet": " branches = Branch._merge_common_prefixes(info, branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1913_C8", "label": "branches = _reduce_to_set()", "type": "assigned_variable", "loc": [1913, 1913], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1899_C4", "vector": [14, 2, 0.4638, 0.0002, 2, 0.88, 0.6667, 286, 3, 2, 0, 0, 959, 10, 1], "semantic": {"name": "branches", "arg_names": [], "import_names": [], "rhs_call_name": "_reduce_to_set", "annotation": ""}, "snippet": " branches = Branch._reduce_to_set(info, branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1915_C8", "label": "if", "type": "if", "loc": [1915, 1918], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1899_C4", "vector": [4, 2, 0.4646, 0.001, 2, 0.88, 0.8333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(branches) > 1:\n sequence = prefix + [Branch(branches)] + suffix\n else:\n sequence = prefix + branches + suffix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1916_C12", "label": "sequence =", "type": "assigned_variable", "loc": [1916, 1916], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1915_C8", "vector": [14, 3, 0.4645, 0.0002, 3, 0.45, 0.0, 871, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sequence", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sequence = prefix + [Branch(branches)] + suffix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1918_C12", "label": "sequence =", "type": "assigned_variable", "loc": [1918, 1918], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1915_C8", "vector": [14, 3, 0.465, 0.0002, 3, 0.45, 1.0, 871, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sequence", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sequence = prefix + branches + suffix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1920_C8", "label": "return", "type": "return", "loc": [1920, 1920], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1899_C4", "vector": [13, 2, 0.4655, 0.0002, 2, 0.88, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return make_sequence(sequence)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1922_C4", "label": "optimise", "type": "function", "loc": [1922, 1934], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.4674, 0.0032, 1, 0.61, 0.1154, 265, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "optimise", "arg_names": ["self", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def optimise(self, info):\n # Flatten branches within branches.\n branches = Branch._flatten_branches(info, self.branches)\n\n # Try to reduce adjacent single-character branches to sets.\n branches = Branch._reduce_to_set(info, branches)\n\n if len(branches) > 1:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1924_C8", "label": "branches = _flatten_branches()", "type": "assigned_variable", "loc": [1924, 1924], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1922_C4", "vector": [14, 2, 0.4664, 0.0002, 2, 0.97, 0.0, 286, 3, 2, 0, 0, 5, 10, 1], "semantic": {"name": "branches", "arg_names": [], "import_names": [], "rhs_call_name": "_flatten_branches", "annotation": ""}, "snippet": " branches = Branch._flatten_branches(info, self.branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1927_C8", "label": "branches = _reduce_to_set()", "type": "assigned_variable", "loc": [1927, 1927], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1922_C4", "vector": [14, 2, 0.4672, 0.0002, 2, 0.97, 0.3333, 286, 3, 2, 0, 0, 959, 10, 1], "semantic": {"name": "branches", "arg_names": [], "import_names": [], "rhs_call_name": "_reduce_to_set", "annotation": ""}, "snippet": " branches = Branch._reduce_to_set(info, branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1929_C8", "label": "if", "type": "if", "loc": [1929, 1932], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1922_C4", "vector": [4, 2, 0.468, 0.001, 2, 0.97, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(branches) > 1:\n sequence = [Branch(branches)]\n else:\n sequence = branches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1930_C12", "label": "sequence =", "type": "assigned_variable", "loc": [1930, 1930], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1929_C8", "vector": [14, 3, 0.4679, 0.0002, 3, 0.92, 0.0, 871, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "sequence", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sequence = [Branch(branches)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1932_C12", "label": "sequence =", "type": "assigned_variable", "loc": [1932, 1932], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1929_C8", "vector": [14, 3, 0.4684, 0.0002, 3, 0.92, 1.0, 871, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sequence", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sequence = branches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1934_C8", "label": "return", "type": "return", "loc": [1934, 1934], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1922_C4", "vector": [13, 2, 0.4688, 0.0002, 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 make_sequence(sequence)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1936_C4", "label": "pack_characters", "type": "function", "loc": [1936, 1938], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.4696, 0.0007, 1, 0.61, 0.1538, 434, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "pack_characters", "arg_names": ["self", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pack_characters(self, info):\n self.branches = [b.pack_characters(info) for b in self.branches]\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1937_C8", "label": "self.branches =", "type": "assigned_variable", "loc": [1937, 1937], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1936_C4", "vector": [14, 2, 0.4696, 0.0002, 2, 0.19, 0.0, 267, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.branches", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.branches = [b.pack_characters(info) for b in self.branches]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1938_C8", "label": "return", "type": "return", "loc": [1938, 1938], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1936_C4", "vector": [13, 2, 0.4698, 0.0002, 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 self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1940_C4", "label": "remove_captures", "type": "function", "loc": [1940, 1942], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.4705, 0.0007, 1, 0.61, 0.1923, 732, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "remove_captures", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove_captures(self):\n self.branches = [b.remove_captures() for b in self.branches]\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1941_C8", "label": "self.branches =", "type": "assigned_variable", "loc": [1941, 1941], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1940_C4", "vector": [14, 2, 0.4705, 0.0002, 2, 0.56, 0.0, 267, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.branches", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.branches = [b.remove_captures() for b in self.branches]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1942_C8", "label": "return", "type": "return", "loc": [1942, 1942], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1940_C4", "vector": [13, 2, 0.4708, 0.0002, 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 self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1944_C4", "label": "is_atomic", "type": "function", "loc": [1944, 1945], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.4714, 0.0005, 1, 0.61, 0.2308, 841, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "is_atomic", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_atomic(self):\n return all(b.is_atomic() for b in self.branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1945_C8", "label": "return", "type": "return", "loc": [1945, 1945], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1944_C4", "vector": [13, 2, 0.4715, 0.0002, 2, 0.94, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return all(b.is_atomic() for b in self.branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1947_C4", "label": "can_be_affix", "type": "function", "loc": [1947, 1948], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.4721, 0.0005, 1, 0.61, 0.2692, 276, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "can_be_affix", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def can_be_affix(self):\n return all(b.can_be_affix() for b in self.branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1948_C8", "label": "return", "type": "return", "loc": [1948, 1948], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1947_C4", "vector": [13, 2, 0.4722, 0.0002, 2, 0.89, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return all(b.can_be_affix() for b in self.branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1950_C4", "label": "contains_group", "type": "function", "loc": [1950, 1951], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.4728, 0.0005, 1, 0.61, 0.3077, 206, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "contains_group", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def contains_group(self):\n return any(b.contains_group() for b in self.branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1951_C8", "label": "return", "type": "return", "loc": [1951, 1951], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1950_C4", "vector": [13, 2, 0.473, 0.0002, 2, 0.12, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return any(b.contains_group() for b in self.branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1953_C4", "label": "get_firstset", "type": "function", "loc": [1953, 1958], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.4741, 0.0015, 1, 0.61, 0.3462, 638, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "get_firstset", "arg_names": ["self", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_firstset(self, reverse):\n fs = set()\n for b in self.branches:\n fs |= b.get_firstset(reverse)\n\n return fs or set([None])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1954_C8", "label": "fs = set()", "type": "assigned_variable", "loc": [1954, 1954], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1953_C4", "vector": [14, 2, 0.4737, 0.0002, 2, 0.19, 0.0, 245, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "fs", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " fs = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1955_C8", "label": "for b", "type": "for", "loc": [1955, 1956], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1953_C4", "vector": [6, 2, 0.4741, 0.0005, 2, 0.19, 0.5, 756, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for b in self.branches:\n fs |= b.get_firstset(reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1958_C8", "label": "return", "type": "return", "loc": [1958, 1958], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1953_C4", "vector": [13, 2, 0.4747, 0.0002, 2, 0.19, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return fs or set([None])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1960_C4", "label": "_compile", "type": "function", "loc": [1960, 1968], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.4761, 0.0022, 1, 0.61, 0.3846, 779, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n code = [(OP.BRANCH, )]\n for b in self.branches:\n code.extend(b.compile(reverse, fuzzy))\n code.append((OP.NEXT, ))\n\n code[-1] = (OP.END, )\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1961_C8", "label": "code =", "type": "assigned_variable", "loc": [1961, 1961], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1960_C4", "vector": [14, 2, 0.4754, 0.0002, 2, 0.85, 0.0, 44, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " code = [(OP.BRANCH, )]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1962_C8", "label": "for b", "type": "for", "loc": [1962, 1964], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1960_C4", "vector": [6, 2, 0.4759, 0.0007, 2, 0.85, 0.3333, 756, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for b in self.branches:\n code.extend(b.compile(reverse, fuzzy))\n code.append((OP.NEXT, ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1963_C12", "label": "extend()", "type": "expression", "loc": [1963, 1963], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1962_C8", "vector": [8, 3, 0.4759, 0.0002, 3, 0.36, 0.0, 660, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " code.extend(b.compile(reverse, fuzzy))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1964_C12", "label": "append()", "type": "expression", "loc": [1964, 1964], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1962_C8", "vector": [8, 3, 0.4761, 0.0002, 3, 0.36, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " code.append((OP.NEXT, ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1966_C8", "label": "assign", "type": "assigned_variable", "loc": [1966, 1966], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1960_C4", "vector": [14, 2, 0.4766, 0.0002, 2, 0.85, 0.6667, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " code[-1] = (OP.END, )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1968_C8", "label": "return", "type": "return", "loc": [1968, 1968], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1960_C4", "vector": [13, 2, 0.4771, 0.0002, 2, 0.85, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1970_C4", "label": "_dump", "type": "function", "loc": [1970, 1975], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.4782, 0.0015, 1, 0.61, 0.4231, 656, 0, 3, 0, 0, 0, 0, 6], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n print(\"{}BRANCH\".format(INDENT * indent))\n self.branches[0].dump(indent + 1, reverse)\n for b in self.branches[1 : ]:\n print(\"{}OR\".format(INDENT * indent))\n b.dump(indent + 1, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1971_C8", "label": "print()", "type": "expression", "loc": [1971, 1971], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1970_C4", "vector": [8, 2, 0.4778, 0.0002, 2, 0.61, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}BRANCH\".format(INDENT * indent))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1972_C8", "label": "dump()", "type": "expression", "loc": [1972, 1972], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1970_C4", "vector": [8, 2, 0.4781, 0.0002, 2, 0.61, 0.5, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " self.branches[0].dump(indent + 1, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1973_C8", "label": "for b", "type": "for", "loc": [1973, 1975], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1970_C4", "vector": [6, 2, 0.4785, 0.0007, 2, 0.61, 1.0, 756, 6, 0, 0, 0, 0, 0, 3], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for b in self.branches[1 : ]:\n print(\"{}OR\".format(INDENT * indent))\n b.dump(indent + 1, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1974_C12", "label": "print()", "type": "expression", "loc": [1974, 1974], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1973_C8", "vector": [8, 3, 0.4785, 0.0002, 3, 0.93, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}OR\".format(INDENT * indent))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1975_C12", "label": "dump()", "type": "expression", "loc": [1975, 1975], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1973_C8", "vector": [8, 3, 0.4788, 0.0002, 3, 0.93, 1.0, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " b.dump(indent + 1, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1978_C4", "label": "_flatten_branches", "type": "function", "loc": [1978, 1988], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.4807, 0.0027, 1, 0.61, 0.4615, 5, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "_flatten_branches", "arg_names": ["info", "branches"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _flatten_branches(info, branches):\n # Flatten the branches so that there aren't branches of branches.\n new_branches = []\n for b in branches:\n b = b.optimise(info)\n if isinstance(b, Branch):\n new_branches.extend(b.branches)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1980_C8", "label": "new_branches =", "type": "assigned_variable", "loc": [1980, 1980], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1978_C4", "vector": [14, 2, 0.48, 0.0002, 2, 0.86, 0.0, 303, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_branches", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_branches = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1981_C8", "label": "for b", "type": "for", "loc": [1981, 1986], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1978_C4", "vector": [6, 2, 0.4808, 0.0015, 2, 0.86, 0.5, 756, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for b in branches:\n b = b.optimise(info)\n if isinstance(b, Branch):\n new_branches.extend(b.branches)\n else:\n new_branches.append(b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1982_C12", "label": "b = optimise()", "type": "assigned_variable", "loc": [1982, 1982], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1981_C8", "vector": [14, 3, 0.4805, 0.0002, 3, 0.49, 0.0, 756, 3, 1, 0, 0, 265, 10, 1], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "optimise", "annotation": ""}, "snippet": " b = b.optimise(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1983_C12", "label": "if", "type": "if", "loc": [1983, 1986], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1981_C8", "vector": [4, 3, 0.4811, 0.001, 3, 0.49, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(b, Branch):\n new_branches.extend(b.branches)\n else:\n new_branches.append(b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1984_C16", "label": "extend()", "type": "expression", "loc": [1984, 1984], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1983_C12", "vector": [8, 4, 0.481, 0.0002, 4, 0.22, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " new_branches.extend(b.branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1986_C16", "label": "append()", "type": "expression", "loc": [1986, 1986], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1983_C12", "vector": [8, 4, 0.4815, 0.0002, 4, 0.22, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_branches.append(b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1988_C8", "label": "return", "type": "return", "loc": [1988, 1988], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1978_C4", "vector": [13, 2, 0.4819, 0.0002, 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 new_branches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "label": "_split_common_prefix", "type": "function", "loc": [1991, 2030], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.4874, 0.0097, 1, 0.61, 0.5, 513, 0, 2, 1, 0, 0, 0, 11], "semantic": {"name": "_split_common_prefix", "arg_names": ["info", "branches"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _split_common_prefix(info, branches):\n # Common leading items can be moved out of the branches.\n # Get the items in the branches.\n alternatives = []\n for b in branches:\n if isinstance(b, Sequence):\n alternatives.append(b.items)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1994_C8", "label": "alternatives =", "type": "assigned_variable", "loc": [1994, 1994], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "vector": [14, 2, 0.4834, 0.0002, 2, 0.03, 0.0, 448, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "alternatives", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " alternatives = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1995_C8", "label": "for b", "type": "for", "loc": [1995, 1999], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "vector": [6, 2, 0.4841, 0.0012, 2, 0.03, 0.0833, 756, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for b in branches:\n if isinstance(b, Sequence):\n alternatives.append(b.items)\n else:\n alternatives.append([b])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1996_C12", "label": "if", "type": "if", "loc": [1996, 1999], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1995_C8", "vector": [4, 3, 0.4842, 0.001, 3, 0.79, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(b, Sequence):\n alternatives.append(b.items)\n else:\n alternatives.append([b])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1997_C16", "label": "append()", "type": "expression", "loc": [1997, 1997], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1996_C12", "vector": [8, 4, 0.4841, 0.0002, 4, 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": " alternatives.append(b.items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1999_C16", "label": "append()", "type": "expression", "loc": [1999, 1999], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1996_C12", "vector": [8, 4, 0.4846, 0.0002, 4, 0.21, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " alternatives.append([b])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2002_C8", "label": "max_count = min()", "type": "assigned_variable", "loc": [2002, 2002], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "vector": [14, 2, 0.4853, 0.0002, 2, 0.03, 0.1667, 632, 3, 1, 0, 0, 867, 10, 2], "semantic": {"name": "max_count", "arg_names": [], "import_names": [], "rhs_call_name": "min", "annotation": ""}, "snippet": " max_count = min(len(a) for a in alternatives)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2005_C8", "label": "prefix =", "type": "assigned_variable", "loc": [2005, 2005], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "vector": [14, 2, 0.4861, 0.0002, 2, 0.03, 0.25, 284, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prefix = alternatives[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2006_C8", "label": "pos =", "type": "assigned_variable", "loc": [2006, 2006], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "vector": [14, 2, 0.4863, 0.0002, 2, 0.03, 0.3333, 627, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2007_C8", "label": "end_pos =", "type": "assigned_variable", "loc": [2007, 2007], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "vector": [14, 2, 0.4865, 0.0002, 2, 0.03, 0.4167, 897, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "end_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " end_pos = max_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L2008_C8", "label": "while", "type": "while", "loc": [2008, 2010], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "vector": [5, 2, 0.487, 0.0007, 2, 0.03, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while pos < end_pos and prefix[pos].can_be_affix() and all(a[pos] ==\n prefix[pos] for a in alternatives):\n pos += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2011_C8", "label": "count =", "type": "assigned_variable", "loc": [2011, 2011], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "vector": [14, 2, 0.4875, 0.0002, 2, 0.03, 0.5833, 778, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count = pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2013_C8", "label": "if", "type": "if", "loc": [2013, 2019], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "vector": [4, 2, 0.4887, 0.0017, 2, 0.03, 0.6667, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if info.flags & UNICODE:\n # We need to check that we're not splitting a sequence of\n # characters which could form part of full case-folding.\n count = pos\n while count > 0 and not all(Branch._can_split(a, count) for a in\n alternatives):\n count -= 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2016_C12", "label": "count =", "type": "assigned_variable", "loc": [2016, 2016], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2013_C8", "vector": [14, 3, 0.4887, 0.0002, 3, 0.16, 0.0, 778, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count = pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L2017_C12", "label": "while", "type": "while", "loc": [2017, 2019], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2013_C8", "vector": [5, 3, 0.4892, 0.0007, 3, 0.16, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while count > 0 and not all(Branch._can_split(a, count) for a in\n alternatives):\n count -= 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2022_C8", "label": "if", "type": "if", "loc": [2022, 2023], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "vector": [4, 2, 0.4903, 0.0005, 2, 0.03, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if count == 0:\n return [], branches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2023_C12", "label": "return", "type": "return", "loc": [2023, 2023], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2022_C8", "vector": [13, 3, 0.4904, 0.0002, 3, 0.31, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [], branches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2026_C8", "label": "new_branches =", "type": "assigned_variable", "loc": [2026, 2026], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "vector": [14, 2, 0.4912, 0.0002, 2, 0.03, 0.8333, 303, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_branches", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_branches = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2027_C8", "label": "for a", "type": "for", "loc": [2027, 2028], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "vector": [6, 2, 0.4915, 0.0005, 2, 0.03, 0.9167, 475, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for a in alternatives:\n new_branches.append(make_sequence(a[count : ]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2028_C12", "label": "append()", "type": "expression", "loc": [2028, 2028], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2027_C8", "vector": [8, 3, 0.4916, 0.0002, 3, 0.85, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_branches.append(make_sequence(a[count : ]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2030_C8", "label": "return", "type": "return", "loc": [2030, 2030], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "vector": [13, 2, 0.4921, 0.0002, 2, 0.03, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return prefix[ : count], new_branches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "label": "_split_common_suffix", "type": "function", "loc": [2033, 2071], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.4975, 0.0095, 1, 0.61, 0.5385, 288, 0, 2, 1, 0, 0, 0, 11], "semantic": {"name": "_split_common_suffix", "arg_names": ["info", "branches"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _split_common_suffix(info, branches):\n # Common trailing items can be moved out of the branches.\n # Get the items in the branches.\n alternatives = []\n for b in branches:\n if isinstance(b, Sequence):\n alternatives.append(b.items)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2036_C8", "label": "alternatives =", "type": "assigned_variable", "loc": [2036, 2036], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "vector": [14, 2, 0.4936, 0.0002, 2, 0.78, 0.0, 448, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "alternatives", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " alternatives = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2037_C8", "label": "for b", "type": "for", "loc": [2037, 2041], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "vector": [6, 2, 0.4943, 0.0012, 2, 0.78, 0.0833, 756, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for b in branches:\n if isinstance(b, Sequence):\n alternatives.append(b.items)\n else:\n alternatives.append([b])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2038_C12", "label": "if", "type": "if", "loc": [2038, 2041], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2037_C8", "vector": [4, 3, 0.4944, 0.001, 3, 0.11, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(b, Sequence):\n alternatives.append(b.items)\n else:\n alternatives.append([b])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2039_C16", "label": "append()", "type": "expression", "loc": [2039, 2039], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2038_C12", "vector": [8, 4, 0.4943, 0.0002, 4, 0.18, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " alternatives.append(b.items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2041_C16", "label": "append()", "type": "expression", "loc": [2041, 2041], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2038_C12", "vector": [8, 4, 0.4948, 0.0002, 4, 0.18, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " alternatives.append([b])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2044_C8", "label": "max_count = min()", "type": "assigned_variable", "loc": [2044, 2044], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "vector": [14, 2, 0.4955, 0.0002, 2, 0.78, 0.1667, 632, 3, 1, 0, 0, 867, 10, 2], "semantic": {"name": "max_count", "arg_names": [], "import_names": [], "rhs_call_name": "min", "annotation": ""}, "snippet": " max_count = min(len(a) for a in alternatives)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2047_C8", "label": "suffix =", "type": "assigned_variable", "loc": [2047, 2047], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "vector": [14, 2, 0.4962, 0.0002, 2, 0.78, 0.25, 578, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "suffix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " suffix = alternatives[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2048_C8", "label": "pos =", "type": "assigned_variable", "loc": [2048, 2048], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "vector": [14, 2, 0.4965, 0.0002, 2, 0.78, 0.3333, 627, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2049_C8", "label": "end_pos =", "type": "assigned_variable", "loc": [2049, 2049], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "vector": [14, 2, 0.4967, 0.0002, 2, 0.78, 0.4167, 897, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "end_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " end_pos = -1 - max_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L2050_C8", "label": "while", "type": "while", "loc": [2050, 2052], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "vector": [5, 2, 0.4972, 0.0007, 2, 0.78, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while pos > end_pos and suffix[pos].can_be_affix() and all(a[pos] ==\n suffix[pos] for a in alternatives):\n pos -= 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2053_C8", "label": "count =", "type": "assigned_variable", "loc": [2053, 2053], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "vector": [14, 2, 0.4977, 0.0002, 2, 0.78, 0.5833, 778, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count = -1 - pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2055_C8", "label": "if", "type": "if", "loc": [2055, 2060], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "vector": [4, 2, 0.4988, 0.0015, 2, 0.78, 0.6667, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if info.flags & UNICODE:\n # We need to check that we're not splitting a sequence of\n # characters which could form part of full case-folding.\n while count > 0 and not all(Branch._can_split_rev(a, count) for a\n in alternatives):\n count -= 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L2058_C12", "label": "while", "type": "while", "loc": [2058, 2060], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2055_C8", "vector": [5, 3, 0.4992, 0.0007, 3, 0.26, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while count > 0 and not all(Branch._can_split_rev(a, count) for a\n in alternatives):\n count -= 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2063_C8", "label": "if", "type": "if", "loc": [2063, 2064], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "vector": [4, 2, 0.5002, 0.0005, 2, 0.78, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if count == 0:\n return [], branches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2064_C12", "label": "return", "type": "return", "loc": [2064, 2064], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2063_C8", "vector": [13, 3, 0.5004, 0.0002, 3, 0.52, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [], branches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2067_C8", "label": "new_branches =", "type": "assigned_variable", "loc": [2067, 2067], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "vector": [14, 2, 0.5011, 0.0002, 2, 0.78, 0.8333, 303, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_branches", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_branches = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2068_C8", "label": "for a", "type": "for", "loc": [2068, 2069], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "vector": [6, 2, 0.5015, 0.0005, 2, 0.78, 0.9167, 475, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for a in alternatives:\n new_branches.append(make_sequence(a[ : -count]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2069_C12", "label": "append()", "type": "expression", "loc": [2069, 2069], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2068_C8", "vector": [8, 3, 0.5016, 0.0002, 3, 0.06, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_branches.append(make_sequence(a[ : -count]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2071_C8", "label": "return", "type": "return", "loc": [2071, 2071], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "vector": [13, 2, 0.5021, 0.0002, 2, 0.78, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return suffix[-count : ], new_branches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2074_C4", "label": "_can_split", "type": "function", "loc": [2074, 2096], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.5055, 0.0056, 1, 0.61, 0.5769, 443, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "_can_split", "arg_names": ["items", "count"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _can_split(items, count):\n # Check the characters either side of the proposed split.\n if not Branch._is_full_case(items, count - 1):\n return True\n\n if not Branch._is_full_case(items, count):\n return True\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2076_C8", "label": "if", "type": "if", "loc": [2076, 2077], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2074_C4", "vector": [4, 2, 0.5034, 0.0005, 2, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not Branch._is_full_case(items, count - 1):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2077_C12", "label": "return", "type": "return", "loc": [2077, 2077], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2076_C8", "vector": [13, 3, 0.5035, 0.0002, 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_1389:If_L2079_C8", "label": "if", "type": "if", "loc": [2079, 2080], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2074_C4", "vector": [4, 2, 0.5041, 0.0005, 2, 0.2, 0.2, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not Branch._is_full_case(items, count):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2080_C12", "label": "return", "type": "return", "loc": [2080, 2080], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2079_C8", "vector": [13, 3, 0.5042, 0.0002, 3, 0.06, 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_1389:If_L2083_C8", "label": "if", "type": "if", "loc": [2083, 2084], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2074_C4", "vector": [4, 2, 0.5051, 0.0005, 2, 0.2, 0.4, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if Branch._is_folded(items[count - 1 : count + 1]):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2084_C12", "label": "return", "type": "return", "loc": [2084, 2084], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2083_C8", "vector": [13, 3, 0.5052, 0.0002, 3, 0.46, 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_1389:If_L2087_C8", "label": "if", "type": "if", "loc": [2087, 2089], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2074_C4", "vector": [4, 2, 0.5062, 0.0007, 2, 0.2, 0.6, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (Branch._is_full_case(items, count + 2) and\n Branch._is_folded(items[count - 1 : count + 2])):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2089_C12", "label": "return", "type": "return", "loc": [2089, 2089], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2087_C8", "vector": [13, 3, 0.5064, 0.0002, 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_1389:If_L2092_C8", "label": "if", "type": "if", "loc": [2092, 2094], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2074_C4", "vector": [4, 2, 0.5074, 0.0007, 2, 0.2, 0.8, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (Branch._is_full_case(items, count - 2) and\n Branch._is_folded(items[count - 2 : count + 1])):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2094_C12", "label": "return", "type": "return", "loc": [2094, 2094], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2092_C8", "vector": [13, 3, 0.5076, 0.0002, 3, 0.66, 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_1389:Return_L2096_C8", "label": "return", "type": "return", "loc": [2096, 2096], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2074_C4", "vector": [13, 2, 0.5081, 0.0002, 2, 0.2, 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_1389:FunctionDef_L2099_C4", "label": "_can_split_rev", "type": "function", "loc": [2099, 2123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.5118, 0.0061, 1, 0.61, 0.6154, 401, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "_can_split_rev", "arg_names": ["items", "count"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _can_split_rev(items, count):\n end = len(items)\n\n # Check the characters either side of the proposed split.\n if not Branch._is_full_case(items, end - count):\n return True\n\n if not Branch._is_full_case(items, end - count - 1):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2100_C8", "label": "end = len()", "type": "assigned_variable", "loc": [2100, 2100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2099_C4", "vector": [14, 2, 0.5091, 0.0002, 2, 0.2, 0.0, 128, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " end = len(items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2103_C8", "label": "if", "type": "if", "loc": [2103, 2104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2099_C4", "vector": [4, 2, 0.5099, 0.0005, 2, 0.2, 0.1667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not Branch._is_full_case(items, end - count):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2104_C12", "label": "return", "type": "return", "loc": [2104, 2104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2103_C8", "vector": [13, 3, 0.5101, 0.0002, 3, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2106_C8", "label": "if", "type": "if", "loc": [2106, 2107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2099_C4", "vector": [4, 2, 0.5107, 0.0005, 2, 0.2, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not Branch._is_full_case(items, end - count - 1):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2107_C12", "label": "return", "type": "return", "loc": [2107, 2107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2106_C8", "vector": [13, 3, 0.5108, 0.0002, 3, 0.79, 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_1389:If_L2110_C8", "label": "if", "type": "if", "loc": [2110, 2111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2099_C4", "vector": [4, 2, 0.5116, 0.0005, 2, 0.2, 0.5, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if Branch._is_folded(items[end - count - 1 : end - count + 1]):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2111_C12", "label": "return", "type": "return", "loc": [2111, 2111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2110_C8", "vector": [13, 3, 0.5118, 0.0002, 3, 0.84, 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_1389:If_L2114_C8", "label": "if", "type": "if", "loc": [2114, 2116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2099_C4", "vector": [4, 2, 0.5127, 0.0007, 2, 0.2, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (Branch._is_full_case(items, end - count + 2) and\n Branch._is_folded(items[end - count - 1 : end - count + 2])):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2116_C12", "label": "return", "type": "return", "loc": [2116, 2116], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2114_C8", "vector": [13, 3, 0.513, 0.0002, 3, 0.24, 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_1389:If_L2119_C8", "label": "if", "type": "if", "loc": [2119, 2121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2099_C4", "vector": [4, 2, 0.5139, 0.0007, 2, 0.2, 0.8333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (Branch._is_full_case(items, end - count - 2) and\n Branch._is_folded(items[end - count - 2 : end - count + 1])):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2121_C12", "label": "return", "type": "return", "loc": [2121, 2121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2119_C8", "vector": [13, 3, 0.5142, 0.0002, 3, 0.1, 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_1389:Return_L2123_C8", "label": "return", "type": "return", "loc": [2123, 2123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2099_C4", "vector": [13, 2, 0.5147, 0.0002, 2, 0.2, 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_1389:FunctionDef_L2126_C4", "label": "_merge_common_prefixes", "type": "function", "loc": [2126, 2150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.5183, 0.0061, 1, 0.61, 0.6538, 851, 0, 2, 1, 0, 0, 0, 13], "semantic": {"name": "_merge_common_prefixes", "arg_names": ["info", "branches"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _merge_common_prefixes(info, branches):\n # Branches with the same case-sensitive character prefix can be grouped\n # together if they are separated only by other branches with a\n # character prefix.\n prefixed = defaultdict(list)\n order = {}\n new_branches = []\n for b in branches:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2130_C8", "label": "prefixed = defaultdict()", "type": "assigned_variable", "loc": [2130, 2130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2126_C4", "vector": [14, 2, 0.5164, 0.0002, 2, 0.18, 0.0, 534, 3, 1, 0, 0, 626, 10, 1], "semantic": {"name": "prefixed", "arg_names": [], "import_names": [], "rhs_call_name": "defaultdict", "annotation": ""}, "snippet": " prefixed = defaultdict(list)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2131_C8", "label": "order =", "type": "assigned_variable", "loc": [2131, 2131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2126_C4", "vector": [14, 2, 0.5166, 0.0002, 2, 0.18, 0.2, 234, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "order", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " order = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2132_C8", "label": "new_branches =", "type": "assigned_variable", "loc": [2132, 2132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2126_C4", "vector": [14, 2, 0.5168, 0.0002, 2, 0.18, 0.4, 303, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_branches", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_branches = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2133_C8", "label": "for b", "type": "for", "loc": [2133, 2146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2126_C4", "vector": [6, 2, 0.5187, 0.0034, 2, 0.18, 0.6, 756, 2, 0, 0, 0, 0, 0, 11], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for b in branches:\n if Branch._is_simple_character(b):\n # Branch starts with a simple character.\n prefixed[b.value].append([b])\n order.setdefault(b.value, len(order))\n elif (isinstance(b, Sequence) and b.items and\n Branch._is_simple_character(b.items[0])):\n # Branch starts with a simple character."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2134_C12", "label": "if", "type": "if", "loc": [2134, 2146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2133_C8", "vector": [4, 3, 0.5188, 0.0032, 3, 0.68, 0.0, 0, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if Branch._is_simple_character(b):\n # Branch starts with a simple character.\n prefixed[b.value].append([b])\n order.setdefault(b.value, len(order))\n elif (isinstance(b, Sequence) and b.items and\n Branch._is_simple_character(b.items[0])):\n # Branch starts with a simple character.\n prefixed[b.items[0].value].append(b.items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2136_C16", "label": "append()", "type": "expression", "loc": [2136, 2136], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2134_C12", "vector": [8, 4, 0.5178, 0.0002, 4, 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": " prefixed[b.value].append([b])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2137_C16", "label": "setdefault()", "type": "expression", "loc": [2137, 2137], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2134_C12", "vector": [8, 4, 0.5181, 0.0002, 4, 0.2, 0.5, 262, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " order.setdefault(b.value, len(order))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2138_C12", "label": "if", "type": "if", "loc": [2138, 2146], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2134_C12", "vector": [4, 4, 0.5193, 0.0022, 4, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif (isinstance(b, Sequence) and b.items and\n Branch._is_simple_character(b.items[0])):\n # Branch starts with a simple character.\n prefixed[b.items[0].value].append(b.items)\n order.setdefault(b.items[0].value, len(order))\n else:\n Branch._flush_char_prefix(info, prefixed, order, new_branches)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2141_C16", "label": "append()", "type": "expression", "loc": [2141, 2141], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2138_C12", "vector": [8, 5, 0.519, 0.0002, 5, 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": " prefixed[b.items[0].value].append(b.items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2142_C16", "label": "setdefault()", "type": "expression", "loc": [2142, 2142], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2138_C12", "vector": [8, 5, 0.5193, 0.0002, 5, 0.71, 0.3333, 262, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " order.setdefault(b.items[0].value, len(order))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2144_C16", "label": "_flush_char_prefix()", "type": "expression", "loc": [2144, 2144], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2138_C12", "vector": [8, 5, 0.5198, 0.0002, 5, 0.71, 0.6667, 840, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "_flush_char_prefix", "arg_names": [], "import_names": [], "rhs_call_name": "_flush_char_prefix", "annotation": ""}, "snippet": " Branch._flush_char_prefix(info, prefixed, order, new_branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2146_C16", "label": "append()", "type": "expression", "loc": [2146, 2146], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2138_C12", "vector": [8, 5, 0.5202, 0.0002, 5, 0.71, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_branches.append(b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2148_C8", "label": "_flush_char_prefix()", "type": "expression", "loc": [2148, 2148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2126_C4", "vector": [8, 2, 0.5207, 0.0002, 2, 0.18, 0.8, 840, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "_flush_char_prefix", "arg_names": [], "import_names": [], "rhs_call_name": "_flush_char_prefix", "annotation": ""}, "snippet": " Branch._flush_char_prefix(info, prefixed, order, new_branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2150_C8", "label": "return", "type": "return", "loc": [2150, 2150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2126_C4", "vector": [13, 2, 0.5212, 0.0002, 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 new_branches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2153_C4", "label": "_is_simple_character", "type": "function", "loc": [2153, 2154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.5221, 0.0005, 1, 0.61, 0.6923, 257, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "_is_simple_character", "arg_names": ["c"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _is_simple_character(c):\n return isinstance(c, Character) and c.positive and not c.case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2154_C8", "label": "return", "type": "return", "loc": [2154, 2154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2153_C4", "vector": [13, 2, 0.5222, 0.0002, 2, 0.19, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return isinstance(c, Character) and c.positive and not c.case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2157_C4", "label": "_reduce_to_set", "type": "function", "loc": [2157, 2181], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.5258, 0.0061, 1, 0.61, 0.7308, 959, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "_reduce_to_set", "arg_names": ["info", "branches"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _reduce_to_set(info, branches):\n # Can the branches be reduced to a set?\n new_branches = []\n items = set()\n case_flags = NOCASE\n for b in branches:\n if isinstance(b, (Character, Property, SetBase)):\n # Branch starts with a single character."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2159_C8", "label": "new_branches =", "type": "assigned_variable", "loc": [2159, 2159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2157_C4", "vector": [14, 2, 0.5234, 0.0002, 2, 0.82, 0.0, 303, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_branches", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_branches = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2160_C8", "label": "items = set()", "type": "assigned_variable", "loc": [2160, 2160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2157_C4", "vector": [14, 2, 0.5236, 0.0002, 2, 0.82, 0.2, 339, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " items = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2161_C8", "label": "case_flags =", "type": "assigned_variable", "loc": [2161, 2161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2157_C4", "vector": [14, 2, 0.5239, 0.0002, 2, 0.82, 0.4, 912, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "case_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " case_flags = NOCASE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2162_C8", "label": "for b", "type": "for", "loc": [2162, 2177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2157_C4", "vector": [6, 2, 0.5259, 0.0039, 2, 0.82, 0.6, 756, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for b in branches:\n if isinstance(b, (Character, Property, SetBase)):\n # Branch starts with a single character.\n if b.case_flags != case_flags:\n # Different case sensitivity, so flush.\n Branch._flush_set_members(info, items, case_flags,\n new_branches)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2163_C12", "label": "if", "type": "if", "loc": [2163, 2177], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2162_C8", "vector": [4, 3, 0.5261, 0.0036, 3, 0.07, 0.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(b, (Character, Property, SetBase)):\n # Branch starts with a single character.\n if b.case_flags != case_flags:\n # Different case sensitivity, so flush.\n Branch._flush_set_members(info, items, case_flags,\n new_branches)\n\n case_flags = b.case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2165_C16", "label": "if", "type": "if", "loc": [2165, 2170], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2163_C12", "vector": [4, 4, 0.5255, 0.0015, 4, 0.49, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if b.case_flags != case_flags:\n # Different case sensitivity, so flush.\n Branch._flush_set_members(info, items, case_flags,\n new_branches)\n\n case_flags = b.case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2167_C20", "label": "_flush_set_members()", "type": "expression", "loc": [2167, 2168], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2165_C16", "vector": [8, 5, 0.5255, 0.0005, 5, 0.63, 0.0, 296, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "_flush_set_members", "arg_names": [], "import_names": [], "rhs_call_name": "_flush_set_members", "annotation": ""}, "snippet": " Branch._flush_set_members(info, items, case_flags,\n new_branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2170_C20", "label": "case_flags =", "type": "assigned_variable", "loc": [2170, 2170], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2165_C16", "vector": [14, 5, 0.5261, 0.0002, 5, 0.63, 1.0, 912, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "case_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " case_flags = b.case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2172_C16", "label": "add()", "type": "expression", "loc": [2172, 2172], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2163_C12", "vector": [8, 4, 0.5265, 0.0002, 4, 0.49, 0.3333, 241, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " items.add(b.with_flags(case_flags=NOCASE))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2174_C16", "label": "_flush_set_members()", "type": "expression", "loc": [2174, 2175], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2163_C12", "vector": [8, 4, 0.5272, 0.0005, 4, 0.49, 0.6667, 296, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "_flush_set_members", "arg_names": [], "import_names": [], "rhs_call_name": "_flush_set_members", "annotation": ""}, "snippet": " Branch._flush_set_members(info, items, case_flags,\n new_branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2177_C16", "label": "append()", "type": "expression", "loc": [2177, 2177], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2163_C12", "vector": [8, 4, 0.5278, 0.0002, 4, 0.49, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_branches.append(b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2179_C8", "label": "_flush_set_members()", "type": "expression", "loc": [2179, 2179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2157_C4", "vector": [8, 2, 0.5282, 0.0002, 2, 0.82, 0.8, 296, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "_flush_set_members", "arg_names": [], "import_names": [], "rhs_call_name": "_flush_set_members", "annotation": ""}, "snippet": " Branch._flush_set_members(info, items, case_flags, new_branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2181_C8", "label": "return", "type": "return", "loc": [2181, 2181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2157_C4", "vector": [13, 2, 0.5287, 0.0002, 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 new_branches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2184_C4", "label": "_flush_char_prefix", "type": "function", "loc": [2184, 2207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.5322, 0.0058, 1, 0.61, 0.7692, 840, 0, 4, 0, 0, 0, 0, 17], "semantic": {"name": "_flush_char_prefix", "arg_names": ["info", "prefixed", "order", "new_branches"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _flush_char_prefix(info, prefixed, order, new_branches):\n # Flush the prefixed branches.\n if not prefixed:\n return\n\n for value, branches in sorted(prefixed.items(), key=lambda pair:\n order[pair[0]]):\n if len(branches) == 1:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2186_C8", "label": "if", "type": "if", "loc": [2186, 2187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2184_C4", "vector": [4, 2, 0.5301, 0.0005, 2, 0.1, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not prefixed:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2187_C12", "label": "return", "type": "return", "loc": [2187, 2187], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2186_C8", "vector": [13, 3, 0.5302, 0.0002, 3, 0.32, 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_1389:For_L2189_C8", "label": "for value, branches", "type": "for", "loc": [2189, 2204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2184_C4", "vector": [6, 2, 0.5325, 0.0039, 2, 0.1, 0.3333, 140, 3, 0, 0, 0, 0, 0, 15], "semantic": {"name": "value, branches", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for value, branches in sorted(prefixed.items(), key=lambda pair:\n order[pair[0]]):\n if len(branches) == 1:\n new_branches.append(make_sequence(branches[0]))\n else:\n subbranches = []\n optional = False\n for b in branches:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2191_C12", "label": "if", "type": "if", "loc": [2191, 2204], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2189_C8", "vector": [4, 3, 0.5327, 0.0034, 3, 0.81, 0.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(branches) == 1:\n new_branches.append(make_sequence(branches[0]))\n else:\n subbranches = []\n optional = False\n for b in branches:\n if len(b) > 1:\n subbranches.append(make_sequence(b[1 : ]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2192_C16", "label": "append()", "type": "expression", "loc": [2192, 2192], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2191_C12", "vector": [8, 4, 0.5314, 0.0002, 4, 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_branches.append(make_sequence(branches[0]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2194_C16", "label": "subbranches =", "type": "assigned_variable", "loc": [2194, 2194], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2191_C12", "vector": [14, 4, 0.5319, 0.0002, 4, 0.24, 0.2, 71, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "subbranches", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " subbranches = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2195_C16", "label": "optional =", "type": "assigned_variable", "loc": [2195, 2195], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2191_C12", "vector": [14, 4, 0.5321, 0.0002, 4, 0.24, 0.4, 61, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "optional", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " optional = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2196_C16", "label": "for b", "type": "for", "loc": [2196, 2201], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2191_C12", "vector": [6, 4, 0.533, 0.0015, 4, 0.24, 0.6, 756, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for b in branches:\n if len(b) > 1:\n subbranches.append(make_sequence(b[1 : ]))\n elif not optional:\n subbranches.append(Sequence())\n optional = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2197_C20", "label": "if", "type": "if", "loc": [2197, 2201], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2196_C16", "vector": [4, 5, 0.5331, 0.0012, 5, 0.17, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(b) > 1:\n subbranches.append(make_sequence(b[1 : ]))\n elif not optional:\n subbranches.append(Sequence())\n optional = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2198_C24", "label": "append()", "type": "expression", "loc": [2198, 2198], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2197_C20", "vector": [8, 6, 0.5328, 0.0002, 6, 0.29, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " subbranches.append(make_sequence(b[1 : ]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2199_C20", "label": "if", "type": "if", "loc": [2199, 2201], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2197_C20", "vector": [4, 6, 0.5333, 0.0007, 6, 0.29, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not optional:\n subbranches.append(Sequence())\n optional = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2200_C24", "label": "append()", "type": "expression", "loc": [2200, 2200], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2199_C20", "vector": [8, 7, 0.5333, 0.0002, 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": " subbranches.append(Sequence())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2201_C24", "label": "optional =", "type": "assigned_variable", "loc": [2201, 2201], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2199_C20", "vector": [14, 7, 0.5336, 0.0002, 7, 0.83, 1.0, 61, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "optional", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " optional = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2203_C16", "label": "sequence = Sequence()", "type": "assigned_variable", "loc": [2203, 2203], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2191_C12", "vector": [14, 4, 0.5341, 0.0002, 4, 0.24, 0.8, 871, 3, 1, 0, 0, 853, 10, 3], "semantic": {"name": "sequence", "arg_names": [], "import_names": [], "rhs_call_name": "Sequence", "annotation": ""}, "snippet": " sequence = Sequence([Character(value), Branch(subbranches)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2204_C16", "label": "append()", "type": "expression", "loc": [2204, 2204], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2191_C12", "vector": [8, 4, 0.5343, 0.0002, 4, 0.24, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_branches.append(sequence.optimise(info))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2206_C8", "label": "clear()", "type": "expression", "loc": [2206, 2206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2184_C4", "vector": [8, 2, 0.5348, 0.0002, 2, 0.1, 0.6667, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " prefixed.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2207_C8", "label": "clear()", "type": "expression", "loc": [2207, 2207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2184_C4", "vector": [8, 2, 0.535, 0.0002, 2, 0.1, 1.0, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " order.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2210_C4", "label": "_flush_set_members", "type": "function", "loc": [2210, 2222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.5372, 0.0032, 1, 0.61, 0.8077, 296, 0, 4, 0, 0, 0, 0, 8], "semantic": {"name": "_flush_set_members", "arg_names": ["info", "items", "case_flags", "new_branches"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _flush_set_members(info, items, case_flags, new_branches):\n # Flush the set members.\n if not items:\n return\n\n if len(items) == 1:\n item = list(items)[0]\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2212_C8", "label": "if", "type": "if", "loc": [2212, 2213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2210_C4", "vector": [4, 2, 0.5364, 0.0005, 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 items:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2213_C12", "label": "return", "type": "return", "loc": [2213, 2213], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2212_C8", "vector": [13, 3, 0.5365, 0.0002, 3, 0.12, 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_1389:If_L2215_C8", "label": "if", "type": "if", "loc": [2215, 2218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2210_C4", "vector": [4, 2, 0.5373, 0.001, 2, 0.23, 0.3333, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(items) == 1:\n item = list(items)[0]\n else:\n item = SetUnion(info, list(items)).optimise(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2216_C12", "label": "item =", "type": "assigned_variable", "loc": [2216, 2216], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2215_C8", "vector": [14, 3, 0.5372, 0.0002, 3, 0.39, 0.0, 434, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item = list(items)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2218_C12", "label": "item = optimise()", "type": "assigned_variable", "loc": [2218, 2218], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2215_C8", "vector": [14, 3, 0.5377, 0.0002, 3, 0.39, 1.0, 434, 3, 1, 0, 0, 265, 10, 3], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "optimise", "annotation": ""}, "snippet": " item = SetUnion(info, list(items)).optimise(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2220_C8", "label": "append()", "type": "expression", "loc": [2220, 2220], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2210_C4", "vector": [8, 2, 0.5382, 0.0002, 2, 0.23, 0.6667, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_branches.append(item.with_flags(case_flags=case_flags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2222_C8", "label": "clear()", "type": "expression", "loc": [2222, 2222], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2210_C4", "vector": [8, 2, 0.5387, 0.0002, 2, 0.23, 1.0, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " items.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2225_C4", "label": "_is_full_case", "type": "function", "loc": [2225, 2231], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.5401, 0.0017, 1, 0.61, 0.8462, 441, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "_is_full_case", "arg_names": ["items", "i"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _is_full_case(items, i):\n if not 0 <= i < len(items):\n return False\n\n item = items[i]\n return (isinstance(item, Character) and item.positive and\n (item.case_flags & FULLIGNORECASE) == FULLIGNORECASE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2226_C8", "label": "if", "type": "if", "loc": [2226, 2227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2225_C4", "vector": [4, 2, 0.5398, 0.0005, 2, 0.01, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not 0 <= i < len(items):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2227_C12", "label": "return", "type": "return", "loc": [2227, 2227], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2226_C8", "vector": [13, 3, 0.5399, 0.0002, 3, 0.01, 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_1389:Assign_L2229_C8", "label": "item =", "type": "assigned_variable", "loc": [2229, 2229], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2225_C4", "vector": [14, 2, 0.5404, 0.0002, 2, 0.01, 0.5, 434, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item = items[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2230_C8", "label": "return", "type": "return", "loc": [2230, 2231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2225_C4", "vector": [13, 2, 0.5407, 0.0005, 2, 0.01, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (isinstance(item, Character) and item.positive and\n (item.case_flags & FULLIGNORECASE) == FULLIGNORECASE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2234_C4", "label": "_is_folded", "type": "function", "loc": [2234, 2253], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.5439, 0.0048, 1, 0.61, 0.8846, 930, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "_is_folded", "arg_names": ["items"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _is_folded(items):\n if len(items) < 2:\n return False\n\n for i in items:\n if (not isinstance(i, Character) or not i.positive or not\n i.case_flags):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2235_C8", "label": "if", "type": "if", "loc": [2235, 2236], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2234_C4", "vector": [4, 2, 0.5419, 0.0005, 2, 0.88, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(items) < 2:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2236_C12", "label": "return", "type": "return", "loc": [2236, 2236], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2235_C8", "vector": [13, 3, 0.5421, 0.0002, 3, 0.64, 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_1389:For_L2238_C8", "label": "for i", "type": "for", "loc": [2238, 2241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2234_C4", "vector": [6, 2, 0.5429, 0.001, 2, 0.88, 0.1667, 826, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in items:\n if (not isinstance(i, Character) or not i.positive or not\n i.case_flags):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2239_C12", "label": "if", "type": "if", "loc": [2239, 2241], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2238_C8", "vector": [4, 3, 0.543, 0.0007, 3, 0.21, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not isinstance(i, Character) or not i.positive or not\n i.case_flags):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2241_C16", "label": "return", "type": "return", "loc": [2241, 2241], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2239_C12", "vector": [13, 4, 0.5433, 0.0002, 4, 0.24, 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_1389:Assign_L2243_C8", "label": "folded = join()", "type": "assigned_variable", "loc": [2243, 2243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2234_C4", "vector": [14, 2, 0.5438, 0.0002, 2, 0.88, 0.3333, 68, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "folded", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " folded = \"\".join(chr(i.value) for i in items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2244_C8", "label": "folded = fold_case()", "type": "assigned_variable", "loc": [2244, 2244], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2234_C4", "vector": [14, 2, 0.544, 0.0002, 2, 0.88, 0.5, 68, 3, 2, 0, 0, 184, 10, 1], "semantic": {"name": "folded", "arg_names": [], "import_names": [], "rhs_call_name": "fold_case", "annotation": ""}, "snippet": " folded = _regex.fold_case(FULL_CASE_FOLDING, folded)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2247_C8", "label": "expanding_chars = get_expand_on_folding()", "type": "assigned_variable", "loc": [2247, 2247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2234_C4", "vector": [14, 2, 0.5447, 0.0002, 2, 0.88, 0.6667, 347, 3, 0, 0, 0, 869, 10, 1], "semantic": {"name": "expanding_chars", "arg_names": [], "import_names": [], "rhs_call_name": "get_expand_on_folding", "annotation": ""}, "snippet": " expanding_chars = _regex.get_expand_on_folding()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2249_C8", "label": "for c", "type": "for", "loc": [2249, 2251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2234_C4", "vector": [6, 2, 0.5455, 0.0007, 2, 0.88, 0.8333, 411, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in expanding_chars:\n if folded == _regex.fold_case(FULL_CASE_FOLDING, c):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2250_C12", "label": "if", "type": "if", "loc": [2250, 2251], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2249_C8", "vector": [4, 3, 0.5456, 0.0005, 3, 0.64, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if folded == _regex.fold_case(FULL_CASE_FOLDING, c):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2251_C16", "label": "return", "type": "return", "loc": [2251, 2251], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2250_C12", "vector": [13, 4, 0.5457, 0.0002, 4, 0.18, 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_1389:Return_L2253_C8", "label": "return", "type": "return", "loc": [2253, 2253], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2234_C4", "vector": [13, 2, 0.5462, 0.0002, 2, 0.88, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2255_C4", "label": "is_empty", "type": "function", "loc": [2255, 2256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.5468, 0.0005, 1, 0.61, 0.9231, 623, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "is_empty", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_empty(self):\n return all(b.is_empty() for b in self.branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2256_C8", "label": "return", "type": "return", "loc": [2256, 2256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2255_C4", "vector": [13, 2, 0.5469, 0.0002, 2, 0.28, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return all(b.is_empty() for b in self.branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2258_C4", "label": "__eq__", "type": "function", "loc": [2258, 2259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.5475, 0.0005, 1, 0.61, 0.9615, 763, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n return type(self) is type(other) and self.branches == other.branches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2259_C8", "label": "return", "type": "return", "loc": [2259, 2259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2258_C4", "vector": [13, 2, 0.5476, 0.0002, 2, 0.97, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return type(self) is type(other) and self.branches == other.branches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2261_C4", "label": "max_width", "type": "function", "loc": [2261, 2262], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "vector": [2, 1, 0.5482, 0.0005, 1, 0.61, 1.0, 0, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "max_width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_width(self):\n return max(b.max_width() for b in self.branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2262_C8", "label": "return", "type": "return", "loc": [2262, 2262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2261_C4", "vector": [13, 2, 0.5484, 0.0002, 2, 0.12, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return max(b.max_width() for b in self.branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2264_C0", "label": "CallGroup", "type": "class", "loc": [2264, 2305], "level": 0, "parent": null, "vector": [3, 0, 0.5538, 0.0102, 0, 0.66, 0.7513, 337, 0, 7, 0, 0, 852, 0, 11], "semantic": {"name": "CallGroup", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CallGroup(RegexBase):\n def __init__(self, info, group, position):\n RegexBase.__init__(self)\n self.info = info\n self.group = group\n self.position = position\n\n self._key = self.__class__, self.group"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2265_C4", "label": "__init__", "type": "function", "loc": [2265, 2271], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2264_C0", "vector": [2, 1, 0.5498, 0.0017, 1, 0.48, 0.0, 555, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "info", "group", "position"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, info, group, position):\n RegexBase.__init__(self)\n self.info = info\n self.group = group\n self.position = position\n\n self._key = self.__class__, self.group"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2266_C8", "label": "__init__()", "type": "expression", "loc": [2266, 2266], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2265_C4", "vector": [8, 2, 0.5493, 0.0002, 2, 0.83, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " RegexBase.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2267_C8", "label": "self.info =", "type": "assigned_variable", "loc": [2267, 2267], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2265_C4", "vector": [14, 2, 0.5496, 0.0002, 2, 0.83, 0.25, 264, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.info = info"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2268_C8", "label": "self.group =", "type": "assigned_variable", "loc": [2268, 2268], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2265_C4", "vector": [14, 2, 0.5498, 0.0002, 2, 0.83, 0.5, 561, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.group = group"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2269_C8", "label": "self.position =", "type": "assigned_variable", "loc": [2269, 2269], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2265_C4", "vector": [14, 2, 0.5501, 0.0002, 2, 0.83, 0.75, 95, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.position", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.position = position"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2271_C8", "label": "self._key =", "type": "assigned_variable", "loc": [2271, 2271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2265_C4", "vector": [14, 2, 0.5505, 0.0002, 2, 0.83, 1.0, 449, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "self._key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._key = self.__class__, self.group"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2273_C4", "label": "fix_groups", "type": "function", "loc": [2273, 2290], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2264_C0", "vector": [2, 1, 0.5531, 0.0044, 1, 0.48, 0.1667, 269, 0, 4, 0, 0, 0, 0, 5], "semantic": {"name": "fix_groups", "arg_names": ["self", "pattern", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fix_groups(self, pattern, reverse, fuzzy):\n try:\n self.group = int(self.group)\n except ValueError:\n try:\n self.group = self.info.group_index[self.group]\n except KeyError:\n raise error(\"unknown group\", pattern, self.position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2274_C8", "label": "try", "type": "try", "loc": [2274, 2280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2273_C4", "vector": [7, 2, 0.552, 0.0017, 2, 0.89, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.group = int(self.group)\n except ValueError:\n try:\n self.group = self.info.group_index[self.group]\n except KeyError:\n raise error(\"unknown group\", pattern, self.position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2275_C12", "label": "self.group = int()", "type": "assigned_variable", "loc": [2275, 2275], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2274_C8", "vector": [14, 3, 0.5515, 0.0002, 3, 0.08, 0.0, 561, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "self.group", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " self.group = int(self.group)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2277_C12", "label": "try", "type": "try", "loc": [2277, 2280], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2274_C8", "vector": [7, 3, 0.5524, 0.001, 3, 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 self.group = self.info.group_index[self.group]\n except KeyError:\n raise error(\"unknown group\", pattern, self.position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2278_C16", "label": "self.group =", "type": "assigned_variable", "loc": [2278, 2278], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2277_C12", "vector": [14, 4, 0.5522, 0.0002, 4, 0.71, 0.0, 561, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.group = self.info.group_index[self.group]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2282_C8", "label": "if", "type": "if", "loc": [2282, 2283], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2273_C4", "vector": [4, 2, 0.5533, 0.0005, 2, 0.89, 0.25, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not 0 <= self.group <= self.info.group_count:\n raise error(\"unknown group\", pattern, self.position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2285_C8", "label": "if", "type": "if", "loc": [2285, 2286], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2273_C4", "vector": [4, 2, 0.5541, 0.0005, 2, 0.89, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.group > 0 and self.info.open_group_count[self.group] > 1:\n raise error(\"ambiguous group reference\", pattern, self.position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2288_C8", "label": "append()", "type": "expression", "loc": [2288, 2288], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2273_C4", "vector": [8, 2, 0.5547, 0.0002, 2, 0.89, 0.75, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.info.group_calls.append((self, reverse, fuzzy))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2290_C8", "label": "self._key =", "type": "assigned_variable", "loc": [2290, 2290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2273_C4", "vector": [14, 2, 0.5552, 0.0002, 2, 0.89, 1.0, 449, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "self._key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._key = self.__class__, self.group"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2292_C4", "label": "remove_captures", "type": "function", "loc": [2292, 2293], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2264_C0", "vector": [2, 1, 0.5558, 0.0005, 1, 0.48, 0.3333, 732, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove_captures", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove_captures(self):\n raise error(\"group reference not allowed\", pattern, self.position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2295_C4", "label": "_compile", "type": "function", "loc": [2295, 2296], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2264_C0", "vector": [2, 1, 0.5565, 0.0005, 1, 0.48, 0.5, 779, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n return [(OP.GROUP_CALL, self.call_ref)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2296_C8", "label": "return", "type": "return", "loc": [2296, 2296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2295_C4", "vector": [13, 2, 0.5566, 0.0002, 2, 0.68, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [(OP.GROUP_CALL, self.call_ref)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2298_C4", "label": "_dump", "type": "function", "loc": [2298, 2299], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2264_C0", "vector": [2, 1, 0.5572, 0.0005, 1, 0.48, 0.6667, 656, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n print(\"{}GROUP_CALL {}\".format(INDENT * indent, self.group))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2299_C8", "label": "print()", "type": "expression", "loc": [2299, 2299], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2298_C4", "vector": [8, 2, 0.5573, 0.0002, 2, 0.63, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}GROUP_CALL {}\".format(INDENT * indent, self.group))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2301_C4", "label": "__eq__", "type": "function", "loc": [2301, 2302], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2264_C0", "vector": [2, 1, 0.5579, 0.0005, 1, 0.48, 0.8333, 763, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n return type(self) is type(other) and self.group == other.group"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2302_C8", "label": "return", "type": "return", "loc": [2302, 2302], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2301_C4", "vector": [13, 2, 0.5581, 0.0002, 2, 0.05, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return type(self) is type(other) and self.group == other.group"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2304_C4", "label": "max_width", "type": "function", "loc": [2304, 2305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2264_C0", "vector": [2, 1, 0.5587, 0.0005, 1, 0.48, 1.0, 0, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "max_width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_width(self):\n return UNLIMITED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2305_C8", "label": "return", "type": "return", "loc": [2305, 2305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2304_C4", "vector": [13, 2, 0.5588, 0.0002, 2, 0.77, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return UNLIMITED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "label": "Character", "type": "class", "loc": [2307, 2379], "level": 0, "parent": null, "vector": [3, 0, 0.568, 0.0177, 0, 0.66, 0.7565, 610, 0, 10, 0, 0, 852, 0, 22], "semantic": {"name": "Character", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Character(RegexBase):\n _opcode = {(NOCASE, False): OP.CHARACTER, (IGNORECASE, False):\n OP.CHARACTER_IGN, (FULLCASE, False): OP.CHARACTER, (FULLIGNORECASE,\n False): OP.CHARACTER_IGN, (NOCASE, True): OP.CHARACTER_REV, (IGNORECASE,\n True): OP.CHARACTER_IGN_REV, (FULLCASE, True): OP.CHARACTER_REV,\n (FULLIGNORECASE, True): OP.CHARACTER_IGN_REV}\n\n def __init__(self, value, positive=True, case_flags=NOCASE,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2308_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [2308, 2312], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "vector": [14, 1, 0.56, 0.0012, 1, 0.68, 0.0, 52, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = {(NOCASE, False): OP.CHARACTER, (IGNORECASE, False):\n OP.CHARACTER_IGN, (FULLCASE, False): OP.CHARACTER, (FULLIGNORECASE,\n False): OP.CHARACTER_IGN, (NOCASE, True): OP.CHARACTER_REV, (IGNORECASE,\n True): OP.CHARACTER_IGN_REV, (FULLCASE, True): OP.CHARACTER_REV,\n (FULLIGNORECASE, True): OP.CHARACTER_IGN_REV}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2314_C4", "label": "__init__", "type": "function", "loc": [2314, 2329], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "vector": [2, 1, 0.5628, 0.0039, 1, 0.68, 0.1, 555, 0, 5, 0, 0, 0, 0, 6], "semantic": {"name": "__init__", "arg_names": ["self", "value", "positive", "case_flags", "zerowidth"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, value, positive=True, case_flags=NOCASE,\n zerowidth=False):\n RegexBase.__init__(self)\n self.value = value\n self.positive = bool(positive)\n self.case_flags = case_flags\n self.zerowidth = bool(zerowidth)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2316_C8", "label": "__init__()", "type": "expression", "loc": [2316, 2316], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2314_C4", "vector": [8, 2, 0.5615, 0.0002, 2, 0.64, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " RegexBase.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2317_C8", "label": "self.value =", "type": "assigned_variable", "loc": [2317, 2317], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2314_C4", "vector": [14, 2, 0.5617, 0.0002, 2, 0.64, 0.1667, 966, 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_1389:Assign_L2318_C8", "label": "self.positive = bool()", "type": "assigned_variable", "loc": [2318, 2318], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2314_C4", "vector": [14, 2, 0.5619, 0.0002, 2, 0.64, 0.3333, 226, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "self.positive", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " self.positive = bool(positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2319_C8", "label": "self.case_flags =", "type": "assigned_variable", "loc": [2319, 2319], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2314_C4", "vector": [14, 2, 0.5622, 0.0002, 2, 0.64, 0.5, 56, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.case_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.case_flags = case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2320_C8", "label": "self.zerowidth = bool()", "type": "assigned_variable", "loc": [2320, 2320], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2314_C4", "vector": [14, 2, 0.5624, 0.0002, 2, 0.64, 0.6667, 68, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "self.zerowidth", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " self.zerowidth = bool(zerowidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2322_C8", "label": "if", "type": "if", "loc": [2322, 2326], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2314_C4", "vector": [4, 2, 0.5634, 0.0012, 2, 0.64, 0.8333, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (self.positive and (self.case_flags & FULLIGNORECASE) ==\n FULLIGNORECASE):\n self.folded = _regex.fold_case(FULL_CASE_FOLDING, chr(self.value))\n else:\n self.folded = chr(self.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2324_C12", "label": "self.folded = fold_case()", "type": "assigned_variable", "loc": [2324, 2324], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2322_C8", "vector": [14, 3, 0.5634, 0.0002, 3, 0.03, 0.0, 511, 3, 2, 0, 0, 184, 10, 2], "semantic": {"name": "self.folded", "arg_names": [], "import_names": [], "rhs_call_name": "fold_case", "annotation": ""}, "snippet": " self.folded = _regex.fold_case(FULL_CASE_FOLDING, chr(self.value))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2326_C12", "label": "self.folded = chr()", "type": "assigned_variable", "loc": [2326, 2326], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2322_C8", "vector": [14, 3, 0.5639, 0.0002, 3, 0.03, 1.0, 511, 3, 1, 0, 0, 915, 10, 1], "semantic": {"name": "self.folded", "arg_names": [], "import_names": [], "rhs_call_name": "chr", "annotation": ""}, "snippet": " self.folded = chr(self.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2328_C8", "label": "self._key =", "type": "assigned_variable", "loc": [2328, 2329], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2314_C4", "vector": [14, 2, 0.5645, 0.0005, 2, 0.64, 1.0, 449, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "self._key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._key = (self.__class__, self.value, self.positive,\n self.case_flags, self.zerowidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2331_C4", "label": "rebuild", "type": "function", "loc": [2331, 2332], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "vector": [2, 1, 0.5652, 0.0005, 1, 0.68, 0.2, 486, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "rebuild", "arg_names": ["self", "positive", "case_flags", "zerowidth"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def rebuild(self, positive, case_flags, zerowidth):\n return Character(self.value, positive, case_flags, zerowidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2332_C8", "label": "return", "type": "return", "loc": [2332, 2332], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2331_C4", "vector": [13, 2, 0.5653, 0.0002, 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 Character(self.value, positive, case_flags, zerowidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2334_C4", "label": "optimise", "type": "function", "loc": [2334, 2335], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "vector": [2, 1, 0.5659, 0.0005, 1, 0.68, 0.3, 265, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "optimise", "arg_names": ["self", "info", "in_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def optimise(self, info, in_set=False):\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2335_C8", "label": "return", "type": "return", "loc": [2335, 2335], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2334_C4", "vector": [13, 2, 0.5661, 0.0002, 2, 0.04, 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_1389:FunctionDef_L2337_C4", "label": "get_firstset", "type": "function", "loc": [2337, 2338], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "vector": [2, 1, 0.5667, 0.0005, 1, 0.68, 0.4, 638, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_firstset", "arg_names": ["self", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_firstset(self, reverse):\n return set([self])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2338_C8", "label": "return", "type": "return", "loc": [2338, 2338], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2337_C4", "vector": [13, 2, 0.5668, 0.0002, 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 set([self])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2340_C4", "label": "has_simple_start", "type": "function", "loc": [2340, 2341], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "vector": [2, 1, 0.5674, 0.0005, 1, 0.68, 0.5, 317, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "has_simple_start", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def has_simple_start(self):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2341_C8", "label": "return", "type": "return", "loc": [2341, 2341], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2340_C4", "vector": [13, 2, 0.5675, 0.0002, 2, 0.51, 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_1389:FunctionDef_L2343_C4", "label": "_compile", "type": "function", "loc": [2343, 2360], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "vector": [2, 1, 0.5701, 0.0044, 1, 0.68, 0.6, 779, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n flags = 0\n if self.positive:\n flags |= POSITIVE_OP\n if self.zerowidth:\n flags |= ZEROWIDTH_OP\n if fuzzy:\n flags |= FUZZY_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2344_C8", "label": "flags =", "type": "assigned_variable", "loc": [2344, 2344], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2343_C4", "vector": [14, 2, 0.5682, 0.0002, 2, 0.08, 0.0, 375, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " flags = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2345_C8", "label": "if", "type": "if", "loc": [2345, 2346], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2343_C4", "vector": [4, 2, 0.5686, 0.0005, 2, 0.08, 0.1667, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.positive:\n flags |= POSITIVE_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2347_C8", "label": "if", "type": "if", "loc": [2347, 2348], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2343_C4", "vector": [4, 2, 0.5691, 0.0005, 2, 0.08, 0.3333, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.zerowidth:\n flags |= ZEROWIDTH_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2349_C8", "label": "if", "type": "if", "loc": [2349, 2350], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2343_C4", "vector": [4, 2, 0.5696, 0.0005, 2, 0.08, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if fuzzy:\n flags |= FUZZY_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2352_C8", "label": "code = PrecompiledCode()", "type": "assigned_variable", "loc": [2352, 2353], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2343_C4", "vector": [14, 2, 0.5703, 0.0005, 2, 0.08, 0.6667, 44, 3, 1, 0, 0, 223, 10, 1], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "PrecompiledCode", "annotation": ""}, "snippet": " code = PrecompiledCode([self._opcode[self.case_flags, reverse], flags,\n self.value])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2355_C8", "label": "if", "type": "if", "loc": [2355, 2358], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2343_C4", "vector": [4, 2, 0.5713, 0.001, 2, 0.08, 0.8333, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(self.folded) > 1:\n # The character expands on full case-folding.\n code = Branch([code, String([ord(c) for c in self.folded],\n case_flags=self.case_flags)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2357_C12", "label": "code = Branch()", "type": "assigned_variable", "loc": [2357, 2358], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2355_C8", "vector": [14, 3, 0.5715, 0.0005, 3, 0.52, 0.0, 44, 3, 1, 0, 0, 855, 10, 3], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "Branch", "annotation": ""}, "snippet": " code = Branch([code, String([ord(c) for c in self.folded],\n case_flags=self.case_flags)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2360_C8", "label": "return", "type": "return", "loc": [2360, 2360], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2343_C4", "vector": [13, 2, 0.5721, 0.0002, 2, 0.08, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return code.compile(reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2362_C4", "label": "_dump", "type": "function", "loc": [2362, 2365], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "vector": [2, 1, 0.573, 0.001, 1, 0.68, 0.7, 656, 0, 3, 0, 0, 0, 0, 5], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n display = ascii(chr(self.value)).lstrip(\"bu\")\n print(\"{}CHARACTER {} {}{}\".format(INDENT * indent,\n POS_TEXT[self.positive], display, CASE_TEXT[self.case_flags]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2363_C8", "label": "display = lstrip()", "type": "assigned_variable", "loc": [2363, 2363], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2362_C4", "vector": [14, 2, 0.5728, 0.0002, 2, 0.85, 0.0, 669, 3, 1, 0, 0, 313, 10, 3], "semantic": {"name": "display", "arg_names": [], "import_names": [], "rhs_call_name": "lstrip", "annotation": ""}, "snippet": " display = ascii(chr(self.value)).lstrip(\"bu\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2364_C8", "label": "print()", "type": "expression", "loc": [2364, 2365], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2362_C4", "vector": [8, 2, 0.5732, 0.0005, 2, 0.85, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}CHARACTER {} {}{}\".format(INDENT * indent,\n POS_TEXT[self.positive], display, CASE_TEXT[self.case_flags]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2367_C4", "label": "matches", "type": "function", "loc": [2367, 2368], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "vector": [2, 1, 0.5739, 0.0005, 1, 0.68, 0.8, 684, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "matches", "arg_names": ["self", "ch"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def matches(self, ch):\n return (ch == self.value) == self.positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2368_C8", "label": "return", "type": "return", "loc": [2368, 2368], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2367_C4", "vector": [13, 2, 0.5741, 0.0002, 2, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (ch == self.value) == self.positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2370_C4", "label": "max_width", "type": "function", "loc": [2370, 2371], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "vector": [2, 1, 0.5747, 0.0005, 1, 0.68, 0.9, 0, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "max_width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_width(self):\n return len(self.folded)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2371_C8", "label": "return", "type": "return", "loc": [2371, 2371], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2370_C4", "vector": [13, 2, 0.5748, 0.0002, 2, 0.17, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self.folded)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2373_C4", "label": "get_required_string", "type": "function", "loc": [2373, 2379], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "vector": [2, 1, 0.576, 0.0017, 1, 0.68, 1.0, 720, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "get_required_string", "arg_names": ["self", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_required_string(self, reverse):\n if not self.positive:\n return 1, None\n\n self.folded_characters = tuple(ord(c) for c in self.folded)\n\n return 0, self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2374_C8", "label": "if", "type": "if", "loc": [2374, 2375], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2373_C4", "vector": [4, 2, 0.5756, 0.0005, 2, 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 self.positive:\n return 1, None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2375_C12", "label": "return", "type": "return", "loc": [2375, 2375], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2374_C8", "vector": [13, 3, 0.5758, 0.0002, 3, 0.08, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 1, None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2377_C8", "label": "self.folded_characters = tuple()", "type": "assigned_variable", "loc": [2377, 2377], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2373_C4", "vector": [14, 2, 0.5762, 0.0002, 2, 0.95, 0.5, 249, 3, 1, 0, 0, 259, 10, 2], "semantic": {"name": "self.folded_characters", "arg_names": [], "import_names": [], "rhs_call_name": "tuple", "annotation": ""}, "snippet": " self.folded_characters = tuple(ord(c) for c in self.folded)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2379_C8", "label": "return", "type": "return", "loc": [2379, 2379], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2373_C4", "vector": [13, 2, 0.5767, 0.0002, 2, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0, self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "label": "Conditional", "type": "class", "loc": [2381, 2460], "level": 0, "parent": null, "vector": [3, 0, 0.5868, 0.0194, 0, 0.66, 0.7617, 287, 0, 14, 0, 0, 852, 0, 40], "semantic": {"name": "Conditional", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Conditional(RegexBase):\n def __init__(self, info, group, yes_item, no_item, position):\n RegexBase.__init__(self)\n self.info = info\n self.group = group\n self.yes_item = yes_item\n self.no_item = no_item\n self.position = position"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2382_C4", "label": "__init__", "type": "function", "loc": [2382, 2388], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "vector": [2, 1, 0.5782, 0.0017, 1, 0.35, 0.0, 555, 0, 6, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "info", "group", "yes_item", "no_item", "position"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, info, group, yes_item, no_item, position):\n RegexBase.__init__(self)\n self.info = info\n self.group = group\n self.yes_item = yes_item\n self.no_item = no_item\n self.position = position"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2383_C8", "label": "__init__()", "type": "expression", "loc": [2383, 2383], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2382_C4", "vector": [8, 2, 0.5777, 0.0002, 2, 0.23, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " RegexBase.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2384_C8", "label": "self.info =", "type": "assigned_variable", "loc": [2384, 2384], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2382_C4", "vector": [14, 2, 0.5779, 0.0002, 2, 0.23, 0.2, 264, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.info = info"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2385_C8", "label": "self.group =", "type": "assigned_variable", "loc": [2385, 2385], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2382_C4", "vector": [14, 2, 0.5782, 0.0002, 2, 0.23, 0.4, 561, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.group = group"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2386_C8", "label": "self.yes_item =", "type": "assigned_variable", "loc": [2386, 2386], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2382_C4", "vector": [14, 2, 0.5784, 0.0002, 2, 0.23, 0.6, 629, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.yes_item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.yes_item = yes_item"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2387_C8", "label": "self.no_item =", "type": "assigned_variable", "loc": [2387, 2387], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2382_C4", "vector": [14, 2, 0.5787, 0.0002, 2, 0.23, 0.8, 869, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.no_item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.no_item = no_item"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2388_C8", "label": "self.position =", "type": "assigned_variable", "loc": [2388, 2388], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2382_C4", "vector": [14, 2, 0.5789, 0.0002, 2, 0.23, 1.0, 95, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.position", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.position = position"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2390_C4", "label": "fix_groups", "type": "function", "loc": [2390, 2403], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "vector": [2, 1, 0.581, 0.0034, 1, 0.35, 0.0769, 269, 0, 4, 0, 0, 0, 0, 5], "semantic": {"name": "fix_groups", "arg_names": ["self", "pattern", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fix_groups(self, pattern, reverse, fuzzy):\n try:\n self.group = int(self.group)\n except ValueError:\n try:\n self.group = self.info.group_index[self.group]\n except KeyError:\n raise error(\"unknown group\", pattern, self.position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2391_C8", "label": "try", "type": "try", "loc": [2391, 2397], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2390_C4", "vector": [7, 2, 0.5804, 0.0017, 2, 0.45, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.group = int(self.group)\n except ValueError:\n try:\n self.group = self.info.group_index[self.group]\n except KeyError:\n raise error(\"unknown group\", pattern, self.position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2392_C12", "label": "self.group = int()", "type": "assigned_variable", "loc": [2392, 2392], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2391_C8", "vector": [14, 3, 0.5799, 0.0002, 3, 0.59, 0.0, 561, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "self.group", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " self.group = int(self.group)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2394_C12", "label": "try", "type": "try", "loc": [2394, 2397], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2391_C8", "vector": [7, 3, 0.5807, 0.001, 3, 0.59, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.group = self.info.group_index[self.group]\n except KeyError:\n raise error(\"unknown group\", pattern, self.position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2395_C16", "label": "self.group =", "type": "assigned_variable", "loc": [2395, 2395], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2394_C12", "vector": [14, 4, 0.5806, 0.0002, 4, 0.49, 0.0, 561, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.group = self.info.group_index[self.group]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2399_C8", "label": "if", "type": "if", "loc": [2399, 2400], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2390_C4", "vector": [4, 2, 0.5817, 0.0005, 2, 0.45, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not 1 <= self.group <= self.info.group_count:\n raise error(\"unknown group\", pattern, self.position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2402_C8", "label": "fix_groups()", "type": "expression", "loc": [2402, 2402], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2390_C4", "vector": [8, 2, 0.5823, 0.0002, 2, 0.45, 0.6667, 269, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "fix_groups", "arg_names": [], "import_names": [], "rhs_call_name": "fix_groups", "annotation": ""}, "snippet": " self.yes_item.fix_groups(pattern, reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2403_C8", "label": "fix_groups()", "type": "expression", "loc": [2403, 2403], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2390_C4", "vector": [8, 2, 0.5825, 0.0002, 2, 0.45, 1.0, 269, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "fix_groups", "arg_names": [], "import_names": [], "rhs_call_name": "fix_groups", "annotation": ""}, "snippet": " self.no_item.fix_groups(pattern, reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2405_C4", "label": "optimise", "type": "function", "loc": [2405, 2409], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "vector": [2, 1, 0.5835, 0.0012, 1, 0.35, 0.1538, 265, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "optimise", "arg_names": ["self", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def optimise(self, info):\n yes_item = self.yes_item.optimise(info)\n no_item = self.no_item.optimise(info)\n\n return Conditional(info, self.group, yes_item, no_item, self.position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2406_C8", "label": "yes_item = optimise()", "type": "assigned_variable", "loc": [2406, 2406], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2405_C4", "vector": [14, 2, 0.5833, 0.0002, 2, 0.49, 0.0, 845, 3, 1, 0, 0, 265, 10, 1], "semantic": {"name": "yes_item", "arg_names": [], "import_names": [], "rhs_call_name": "optimise", "annotation": ""}, "snippet": " yes_item = self.yes_item.optimise(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2407_C8", "label": "no_item = optimise()", "type": "assigned_variable", "loc": [2407, 2407], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2405_C4", "vector": [14, 2, 0.5835, 0.0002, 2, 0.49, 0.5, 837, 3, 1, 0, 0, 265, 10, 1], "semantic": {"name": "no_item", "arg_names": [], "import_names": [], "rhs_call_name": "optimise", "annotation": ""}, "snippet": " no_item = self.no_item.optimise(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2409_C8", "label": "return", "type": "return", "loc": [2409, 2409], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2405_C4", "vector": [13, 2, 0.584, 0.0002, 2, 0.49, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Conditional(info, self.group, yes_item, no_item, self.position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2411_C4", "label": "pack_characters", "type": "function", "loc": [2411, 2414], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "vector": [2, 1, 0.5848, 0.001, 1, 0.35, 0.2308, 434, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "pack_characters", "arg_names": ["self", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pack_characters(self, info):\n self.yes_item = self.yes_item.pack_characters(info)\n self.no_item = self.no_item.pack_characters(info)\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2412_C8", "label": "self.yes_item = pack_characters()", "type": "assigned_variable", "loc": [2412, 2412], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2411_C4", "vector": [14, 2, 0.5847, 0.0002, 2, 0.95, 0.0, 629, 3, 1, 0, 0, 434, 10, 1], "semantic": {"name": "self.yes_item", "arg_names": [], "import_names": [], "rhs_call_name": "pack_characters", "annotation": ""}, "snippet": " self.yes_item = self.yes_item.pack_characters(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2413_C8", "label": "self.no_item = pack_characters()", "type": "assigned_variable", "loc": [2413, 2413], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2411_C4", "vector": [14, 2, 0.585, 0.0002, 2, 0.95, 0.5, 869, 3, 1, 0, 0, 434, 10, 1], "semantic": {"name": "self.no_item", "arg_names": [], "import_names": [], "rhs_call_name": "pack_characters", "annotation": ""}, "snippet": " self.no_item = self.no_item.pack_characters(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2414_C8", "label": "return", "type": "return", "loc": [2414, 2414], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2411_C4", "vector": [13, 2, 0.5852, 0.0002, 2, 0.95, 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_1389:FunctionDef_L2416_C4", "label": "remove_captures", "type": "function", "loc": [2416, 2418], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "vector": [2, 1, 0.5859, 0.0007, 1, 0.35, 0.3077, 732, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "remove_captures", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove_captures(self):\n self.yes_item = self.yes_item.remove_captures()\n self.no_item = self.no_item.remove_captures()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2417_C8", "label": "self.yes_item = remove_captures()", "type": "assigned_variable", "loc": [2417, 2417], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2416_C4", "vector": [14, 2, 0.5859, 0.0002, 2, 0.45, 0.0, 629, 3, 0, 0, 0, 732, 10, 1], "semantic": {"name": "self.yes_item", "arg_names": [], "import_names": [], "rhs_call_name": "remove_captures", "annotation": ""}, "snippet": " self.yes_item = self.yes_item.remove_captures()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2418_C8", "label": "self.no_item = remove_captures()", "type": "assigned_variable", "loc": [2418, 2418], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2416_C4", "vector": [14, 2, 0.5862, 0.0002, 2, 0.45, 1.0, 869, 3, 0, 0, 0, 732, 10, 1], "semantic": {"name": "self.no_item", "arg_names": [], "import_names": [], "rhs_call_name": "remove_captures", "annotation": ""}, "snippet": " self.no_item = self.no_item.remove_captures()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2420_C4", "label": "is_atomic", "type": "function", "loc": [2420, 2421], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "vector": [2, 1, 0.5868, 0.0005, 1, 0.35, 0.3846, 841, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "is_atomic", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_atomic(self):\n return self.yes_item.is_atomic() and self.no_item.is_atomic()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2421_C8", "label": "return", "type": "return", "loc": [2421, 2421], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2420_C4", "vector": [13, 2, 0.5869, 0.0002, 2, 0.62, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.yes_item.is_atomic() and self.no_item.is_atomic()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2423_C4", "label": "can_be_affix", "type": "function", "loc": [2423, 2424], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "vector": [2, 1, 0.5875, 0.0005, 1, 0.35, 0.4615, 276, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "can_be_affix", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def can_be_affix(self):\n return self.yes_item.can_be_affix() and self.no_item.can_be_affix()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2424_C8", "label": "return", "type": "return", "loc": [2424, 2424], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2423_C4", "vector": [13, 2, 0.5876, 0.0002, 2, 0.98, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.yes_item.can_be_affix() and self.no_item.can_be_affix()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2426_C4", "label": "contains_group", "type": "function", "loc": [2426, 2427], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "vector": [2, 1, 0.5882, 0.0005, 1, 0.35, 0.5385, 206, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "contains_group", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def contains_group(self):\n return self.yes_item.contains_group() or self.no_item.contains_group()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2427_C8", "label": "return", "type": "return", "loc": [2427, 2427], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2426_C4", "vector": [13, 2, 0.5884, 0.0002, 2, 0.26, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.yes_item.contains_group() or self.no_item.contains_group()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2429_C4", "label": "get_firstset", "type": "function", "loc": [2429, 2431], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "vector": [2, 1, 0.5891, 0.0007, 1, 0.35, 0.6154, 638, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "get_firstset", "arg_names": ["self", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_firstset(self, reverse):\n return (self.yes_item.get_firstset(reverse) |\n self.no_item.get_firstset(reverse))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2430_C8", "label": "return", "type": "return", "loc": [2430, 2431], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2429_C4", "vector": [13, 2, 0.5892, 0.0005, 2, 0.86, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (self.yes_item.get_firstset(reverse) |\n self.no_item.get_firstset(reverse))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2433_C4", "label": "_compile", "type": "function", "loc": [2433, 2443], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "vector": [2, 1, 0.591, 0.0027, 1, 0.35, 0.6923, 779, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n code = [(OP.GROUP_EXISTS, self.group)]\n code.extend(self.yes_item.compile(reverse, fuzzy))\n add_code = self.no_item.compile(reverse, fuzzy)\n if add_code:\n code.append((OP.NEXT, ))\n code.extend(add_code)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2434_C8", "label": "code =", "type": "assigned_variable", "loc": [2434, 2434], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2433_C4", "vector": [14, 2, 0.5901, 0.0002, 2, 0.12, 0.0, 44, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " code = [(OP.GROUP_EXISTS, self.group)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2435_C8", "label": "extend()", "type": "expression", "loc": [2435, 2435], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2433_C4", "vector": [8, 2, 0.5903, 0.0002, 2, 0.12, 0.2, 660, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " code.extend(self.yes_item.compile(reverse, fuzzy))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2436_C8", "label": "add_code = compile()", "type": "assigned_variable", "loc": [2436, 2436], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2433_C4", "vector": [14, 2, 0.5905, 0.0002, 2, 0.12, 0.4, 628, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "add_code", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " add_code = self.no_item.compile(reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2437_C8", "label": "if", "type": "if", "loc": [2437, 2439], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2433_C4", "vector": [4, 2, 0.591, 0.0007, 2, 0.12, 0.6, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if add_code:\n code.append((OP.NEXT, ))\n code.extend(add_code)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2438_C12", "label": "append()", "type": "expression", "loc": [2438, 2438], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2437_C8", "vector": [8, 3, 0.591, 0.0002, 3, 0.53, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " code.append((OP.NEXT, ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2439_C12", "label": "extend()", "type": "expression", "loc": [2439, 2439], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2437_C8", "vector": [8, 3, 0.5913, 0.0002, 3, 0.53, 1.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " code.extend(add_code)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2441_C8", "label": "append()", "type": "expression", "loc": [2441, 2441], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2433_C4", "vector": [8, 2, 0.5918, 0.0002, 2, 0.12, 0.8, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " code.append((OP.END, ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2443_C8", "label": "return", "type": "return", "loc": [2443, 2443], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2433_C4", "vector": [13, 2, 0.5922, 0.0002, 2, 0.12, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2445_C4", "label": "_dump", "type": "function", "loc": [2445, 2450], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "vector": [2, 1, 0.5933, 0.0015, 1, 0.35, 0.7692, 656, 0, 3, 0, 0, 0, 0, 6], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n print(\"{}GROUP_EXISTS {}\".format(INDENT * indent, self.group))\n self.yes_item.dump(indent + 1, reverse)\n if self.no_item:\n print(\"{}OR\".format(INDENT * indent))\n self.no_item.dump(indent + 1, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2446_C8", "label": "print()", "type": "expression", "loc": [2446, 2446], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2445_C4", "vector": [8, 2, 0.593, 0.0002, 2, 0.52, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}GROUP_EXISTS {}\".format(INDENT * indent, self.group))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2447_C8", "label": "dump()", "type": "expression", "loc": [2447, 2447], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2445_C4", "vector": [8, 2, 0.5932, 0.0002, 2, 0.52, 0.5, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " self.yes_item.dump(indent + 1, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2448_C8", "label": "if", "type": "if", "loc": [2448, 2450], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2445_C4", "vector": [4, 2, 0.5937, 0.0007, 2, 0.52, 1.0, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.no_item:\n print(\"{}OR\".format(INDENT * indent))\n self.no_item.dump(indent + 1, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2449_C12", "label": "print()", "type": "expression", "loc": [2449, 2449], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2448_C8", "vector": [8, 3, 0.5937, 0.0002, 3, 0.61, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}OR\".format(INDENT * indent))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2450_C12", "label": "dump()", "type": "expression", "loc": [2450, 2450], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2448_C8", "vector": [8, 3, 0.5939, 0.0002, 3, 0.61, 1.0, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " self.no_item.dump(indent + 1, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2452_C4", "label": "is_empty", "type": "function", "loc": [2452, 2453], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "vector": [2, 1, 0.5945, 0.0005, 1, 0.35, 0.8462, 623, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "is_empty", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_empty(self):\n return self.yes_item.is_empty() and self.no_item.is_empty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2453_C8", "label": "return", "type": "return", "loc": [2453, 2453], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2452_C4", "vector": [13, 2, 0.5947, 0.0002, 2, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.yes_item.is_empty() and self.no_item.is_empty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2455_C4", "label": "__eq__", "type": "function", "loc": [2455, 2457], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "vector": [2, 1, 0.5954, 0.0007, 1, 0.35, 0.9231, 763, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n return type(self) is type(other) and (self.group, self.yes_item,\n self.no_item) == (other.group, other.yes_item, other.no_item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2456_C8", "label": "return", "type": "return", "loc": [2456, 2457], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2455_C4", "vector": [13, 2, 0.5955, 0.0005, 2, 0.49, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return type(self) is type(other) and (self.group, self.yes_item,\n self.no_item) == (other.group, other.yes_item, other.no_item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2459_C4", "label": "max_width", "type": "function", "loc": [2459, 2460], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "vector": [2, 1, 0.5962, 0.0005, 1, 0.35, 1.0, 0, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "max_width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_width(self):\n return max(self.yes_item.max_width(), self.no_item.max_width())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2460_C8", "label": "return", "type": "return", "loc": [2460, 2460], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2459_C4", "vector": [13, 2, 0.5964, 0.0002, 2, 0.22, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return max(self.yes_item.max_width(), self.no_item.max_width())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2462_C0", "label": "DefaultBoundary", "type": "class", "loc": [2462, 2464], "level": 0, "parent": null, "vector": [3, 0, 0.5971, 0.0007, 0, 0.66, 0.7668, 266, 0, 0, 0, 0, 752, 0, 0], "semantic": {"name": "DefaultBoundary", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DefaultBoundary(ZeroWidthBase):\n _opcode = OP.DEFAULT_BOUNDARY\n _op_name = \"DEFAULT_BOUNDARY\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2463_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [2463, 2463], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2462_C0", "vector": [14, 1, 0.5971, 0.0002, 1, 0.74, 0.0, 52, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = OP.DEFAULT_BOUNDARY"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2464_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [2464, 2464], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2462_C0", "vector": [14, 1, 0.5973, 0.0002, 1, 0.74, 1.0, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"DEFAULT_BOUNDARY\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2466_C0", "label": "DefaultEndOfWord", "type": "class", "loc": [2466, 2468], "level": 0, "parent": null, "vector": [3, 0, 0.5981, 0.0007, 0, 0.66, 0.772, 687, 0, 0, 0, 0, 752, 0, 0], "semantic": {"name": "DefaultEndOfWord", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DefaultEndOfWord(ZeroWidthBase):\n _opcode = OP.DEFAULT_END_OF_WORD\n _op_name = \"DEFAULT_END_OF_WORD\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2467_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [2467, 2467], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2466_C0", "vector": [14, 1, 0.5981, 0.0002, 1, 0.19, 0.0, 52, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = OP.DEFAULT_END_OF_WORD"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2468_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [2468, 2468], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2466_C0", "vector": [14, 1, 0.5983, 0.0002, 1, 0.19, 1.0, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"DEFAULT_END_OF_WORD\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2470_C0", "label": "DefaultStartOfWord", "type": "class", "loc": [2470, 2472], "level": 0, "parent": null, "vector": [3, 0, 0.599, 0.0007, 0, 0.66, 0.7772, 443, 0, 0, 0, 0, 752, 0, 0], "semantic": {"name": "DefaultStartOfWord", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DefaultStartOfWord(ZeroWidthBase):\n _opcode = OP.DEFAULT_START_OF_WORD\n _op_name = \"DEFAULT_START_OF_WORD\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2471_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [2471, 2471], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2470_C0", "vector": [14, 1, 0.599, 0.0002, 1, 0.83, 0.0, 52, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = OP.DEFAULT_START_OF_WORD"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2472_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [2472, 2472], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2470_C0", "vector": [14, 1, 0.5993, 0.0002, 1, 0.83, 1.0, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"DEFAULT_START_OF_WORD\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2474_C0", "label": "EndOfLine", "type": "class", "loc": [2474, 2476], "level": 0, "parent": null, "vector": [3, 0, 0.6, 0.0007, 0, 0.66, 0.7824, 748, 0, 0, 0, 0, 752, 0, 0], "semantic": {"name": "EndOfLine", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class EndOfLine(ZeroWidthBase):\n _opcode = OP.END_OF_LINE\n _op_name = \"END_OF_LINE\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2475_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [2475, 2475], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2474_C0", "vector": [14, 1, 0.6, 0.0002, 1, 0.6, 0.0, 52, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = OP.END_OF_LINE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2476_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [2476, 2476], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2474_C0", "vector": [14, 1, 0.6002, 0.0002, 1, 0.6, 1.0, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"END_OF_LINE\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2478_C0", "label": "EndOfLineU", "type": "class", "loc": [2478, 2480], "level": 0, "parent": null, "vector": [3, 0, 0.601, 0.0007, 0, 0.66, 0.7876, 398, 0, 0, 0, 0, 748, 0, 0], "semantic": {"name": "EndOfLineU", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class EndOfLineU(EndOfLine):\n _opcode = OP.END_OF_LINE_U\n _op_name = \"END_OF_LINE_U\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2479_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [2479, 2479], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2478_C0", "vector": [14, 1, 0.601, 0.0002, 1, 0.1, 0.0, 52, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = OP.END_OF_LINE_U"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2480_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [2480, 2480], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2478_C0", "vector": [14, 1, 0.6012, 0.0002, 1, 0.1, 1.0, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"END_OF_LINE_U\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2482_C0", "label": "EndOfString", "type": "class", "loc": [2482, 2484], "level": 0, "parent": null, "vector": [3, 0, 0.6019, 0.0007, 0, 0.66, 0.7927, 667, 0, 0, 0, 0, 752, 0, 0], "semantic": {"name": "EndOfString", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class EndOfString(ZeroWidthBase):\n _opcode = OP.END_OF_STRING\n _op_name = \"END_OF_STRING\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2483_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [2483, 2483], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2482_C0", "vector": [14, 1, 0.6019, 0.0002, 1, 0.43, 0.0, 52, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = OP.END_OF_STRING"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2484_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [2484, 2484], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2482_C0", "vector": [14, 1, 0.6022, 0.0002, 1, 0.43, 1.0, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"END_OF_STRING\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2486_C0", "label": "EndOfStringLine", "type": "class", "loc": [2486, 2488], "level": 0, "parent": null, "vector": [3, 0, 0.6029, 0.0007, 0, 0.66, 0.7979, 305, 0, 0, 0, 0, 752, 0, 0], "semantic": {"name": "EndOfStringLine", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class EndOfStringLine(ZeroWidthBase):\n _opcode = OP.END_OF_STRING_LINE\n _op_name = \"END_OF_STRING_LINE\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2487_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [2487, 2487], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2486_C0", "vector": [14, 1, 0.6029, 0.0002, 1, 0.79, 0.0, 52, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = OP.END_OF_STRING_LINE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2488_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [2488, 2488], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2486_C0", "vector": [14, 1, 0.6032, 0.0002, 1, 0.79, 1.0, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"END_OF_STRING_LINE\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2490_C0", "label": "EndOfStringLineU", "type": "class", "loc": [2490, 2492], "level": 0, "parent": null, "vector": [3, 0, 0.6039, 0.0007, 0, 0.66, 0.8031, 276, 0, 0, 0, 0, 305, 0, 0], "semantic": {"name": "EndOfStringLineU", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class EndOfStringLineU(EndOfStringLine):\n _opcode = OP.END_OF_STRING_LINE_U\n _op_name = \"END_OF_STRING_LINE_U\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2491_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [2491, 2491], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2490_C0", "vector": [14, 1, 0.6039, 0.0002, 1, 0.96, 0.0, 52, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = OP.END_OF_STRING_LINE_U"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2492_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [2492, 2492], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2490_C0", "vector": [14, 1, 0.6041, 0.0002, 1, 0.96, 1.0, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"END_OF_STRING_LINE_U\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2494_C0", "label": "EndOfWord", "type": "class", "loc": [2494, 2496], "level": 0, "parent": null, "vector": [3, 0, 0.6048, 0.0007, 0, 0.66, 0.8083, 513, 0, 0, 0, 0, 752, 0, 0], "semantic": {"name": "EndOfWord", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class EndOfWord(ZeroWidthBase):\n _opcode = OP.END_OF_WORD\n _op_name = \"END_OF_WORD\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2495_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [2495, 2495], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2494_C0", "vector": [14, 1, 0.6048, 0.0002, 1, 0.91, 0.0, 52, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = OP.END_OF_WORD"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2496_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [2496, 2496], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2494_C0", "vector": [14, 1, 0.6051, 0.0002, 1, 0.91, 1.0, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"END_OF_WORD\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "label": "Fuzzy", "type": "class", "loc": [2498, 2622], "level": 0, "parent": null, "vector": [3, 0, 0.6206, 0.0303, 0, 0.66, 0.8135, 319, 0, 12, 0, 0, 852, 0, 35], "semantic": {"name": "Fuzzy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Fuzzy(RegexBase):\n def __init__(self, subpattern, constraints=None):\n RegexBase.__init__(self)\n if constraints is None:\n constraints = {}\n self.subpattern = subpattern\n self.constraints = constraints\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2499_C4", "label": "__init__", "type": "function", "loc": [2499, 2532], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "vector": [2, 1, 0.6098, 0.0082, 1, 0.79, 0.0, 555, 0, 3, 0, 0, 0, 0, 8], "semantic": {"name": "__init__", "arg_names": ["self", "subpattern", "constraints"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, subpattern, constraints=None):\n RegexBase.__init__(self)\n if constraints is None:\n constraints = {}\n self.subpattern = subpattern\n self.constraints = constraints\n\n # If an error type is mentioned in the cost equation, then its maximum"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2500_C8", "label": "__init__()", "type": "expression", "loc": [2500, 2500], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2499_C4", "vector": [8, 2, 0.6061, 0.0002, 2, 0.23, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " RegexBase.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2501_C8", "label": "if", "type": "if", "loc": [2501, 2502], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2499_C4", "vector": [4, 2, 0.6064, 0.0005, 2, 0.23, 0.1429, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if constraints is None:\n constraints = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2502_C12", "label": "constraints =", "type": "assigned_variable", "loc": [2502, 2502], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2501_C8", "vector": [14, 3, 0.6065, 0.0002, 3, 0.69, 0.0, 394, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "constraints", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " constraints = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2503_C8", "label": "self.subpattern =", "type": "assigned_variable", "loc": [2503, 2503], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2499_C4", "vector": [14, 2, 0.6068, 0.0002, 2, 0.23, 0.2857, 131, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.subpattern = subpattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2504_C8", "label": "self.constraints =", "type": "assigned_variable", "loc": [2504, 2504], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2499_C4", "vector": [14, 2, 0.607, 0.0002, 2, 0.23, 0.4286, 535, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.constraints", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.constraints = constraints"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2508_C8", "label": "if", "type": "if", "loc": [2508, 2511], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2499_C4", "vector": [4, 2, 0.6084, 0.001, 2, 0.23, 0.5714, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if \"cost\" in constraints:\n for e in \"dis\":\n if e in constraints[\"cost\"]:\n constraints.setdefault(e, (0, None))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2509_C12", "label": "for e", "type": "for", "loc": [2509, 2511], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2508_C8", "vector": [6, 3, 0.6085, 0.0007, 3, 0.08, 0.0, 175, 1, 0, 0, 0, 0, 0, 1], "semantic": {"name": "e", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for e in \"dis\":\n if e in constraints[\"cost\"]:\n constraints.setdefault(e, (0, None))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2510_C16", "label": "if", "type": "if", "loc": [2510, 2511], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2509_C12", "vector": [4, 4, 0.6086, 0.0005, 4, 0.88, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if e in constraints[\"cost\"]:\n constraints.setdefault(e, (0, None))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2511_C20", "label": "setdefault()", "type": "expression", "loc": [2511, 2511], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2510_C16", "vector": [8, 5, 0.6087, 0.0002, 5, 0.39, 0.0, 262, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " constraints.setdefault(e, (0, None))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2515_C8", "label": "if", "type": "if", "loc": [2515, 2520], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2499_C4", "vector": [4, 2, 0.6103, 0.0015, 2, 0.23, 0.7143, 0, 4, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if set(constraints) & set(\"dis\"):\n for e in \"dis\":\n constraints.setdefault(e, (0, 0))\n else:\n for e in \"dis\":\n constraints.setdefault(e, (0, None))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2516_C12", "label": "for e", "type": "for", "loc": [2516, 2517], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2515_C8", "vector": [6, 3, 0.6101, 0.0005, 3, 0.91, 0.0, 175, 1, 0, 0, 0, 0, 0, 1], "semantic": {"name": "e", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for e in \"dis\":\n constraints.setdefault(e, (0, 0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2517_C16", "label": "setdefault()", "type": "expression", "loc": [2517, 2517], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2516_C12", "vector": [8, 4, 0.6102, 0.0002, 4, 0.53, 0.0, 262, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " constraints.setdefault(e, (0, 0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2519_C12", "label": "for e", "type": "for", "loc": [2519, 2520], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2515_C8", "vector": [6, 3, 0.6108, 0.0005, 3, 0.91, 1.0, 175, 1, 0, 0, 0, 0, 0, 1], "semantic": {"name": "e", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for e in \"dis\":\n constraints.setdefault(e, (0, None))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2520_C16", "label": "setdefault()", "type": "expression", "loc": [2520, 2520], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2519_C12", "vector": [8, 4, 0.6109, 0.0002, 4, 0.06, 0.0, 262, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " constraints.setdefault(e, (0, None))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2523_C8", "label": "setdefault()", "type": "expression", "loc": [2523, 2523], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2499_C4", "vector": [8, 2, 0.6116, 0.0002, 2, 0.23, 0.8571, 262, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " constraints.setdefault(\"e\", (0, None))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2527_C8", "label": "if", "type": "if", "loc": [2527, 2532], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2499_C4", "vector": [4, 2, 0.6132, 0.0015, 2, 0.23, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if \"cost\" in constraints:\n for e in \"dis\":\n constraints[\"cost\"].setdefault(e, 0)\n else:\n constraints[\"cost\"] = {\"d\": 1, \"i\": 1, \"s\": 1, \"max\":\n constraints[\"e\"][1]}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2528_C12", "label": "for e", "type": "for", "loc": [2528, 2529], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2527_C8", "vector": [6, 3, 0.613, 0.0005, 3, 0.96, 0.0, 175, 1, 0, 0, 0, 0, 0, 1], "semantic": {"name": "e", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for e in \"dis\":\n constraints[\"cost\"].setdefault(e, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2529_C16", "label": "setdefault()", "type": "expression", "loc": [2529, 2529], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2528_C12", "vector": [8, 4, 0.6131, 0.0002, 4, 0.18, 0.0, 262, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " constraints[\"cost\"].setdefault(e, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2531_C12", "label": "assign", "type": "assigned_variable", "loc": [2531, 2532], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2527_C8", "vector": [14, 3, 0.6137, 0.0005, 3, 0.96, 1.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " constraints[\"cost\"] = {\"d\": 1, \"i\": 1, \"s\": 1, \"max\":\n constraints[\"e\"][1]}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2534_C4", "label": "fix_groups", "type": "function", "loc": [2534, 2535], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "vector": [2, 1, 0.6144, 0.0005, 1, 0.79, 0.0909, 269, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "fix_groups", "arg_names": ["self", "pattern", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fix_groups(self, pattern, reverse, fuzzy):\n self.subpattern.fix_groups(pattern, reverse, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2535_C8", "label": "fix_groups()", "type": "expression", "loc": [2535, 2535], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2534_C4", "vector": [8, 2, 0.6145, 0.0002, 2, 0.56, 0.0, 269, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "fix_groups", "arg_names": [], "import_names": [], "rhs_call_name": "fix_groups", "annotation": ""}, "snippet": " self.subpattern.fix_groups(pattern, reverse, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2537_C4", "label": "pack_characters", "type": "function", "loc": [2537, 2539], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "vector": [2, 1, 0.6153, 0.0007, 1, 0.79, 0.1818, 434, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "pack_characters", "arg_names": ["self", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pack_characters(self, info):\n self.subpattern = self.subpattern.pack_characters(info)\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2538_C8", "label": "self.subpattern = pack_characters()", "type": "assigned_variable", "loc": [2538, 2538], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2537_C4", "vector": [14, 2, 0.6153, 0.0002, 2, 0.0, 0.0, 131, 3, 1, 0, 0, 434, 10, 1], "semantic": {"name": "self.subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "pack_characters", "annotation": ""}, "snippet": " self.subpattern = self.subpattern.pack_characters(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2539_C8", "label": "return", "type": "return", "loc": [2539, 2539], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2537_C4", "vector": [13, 2, 0.6155, 0.0002, 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_1389:FunctionDef_L2541_C4", "label": "remove_captures", "type": "function", "loc": [2541, 2543], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "vector": [2, 1, 0.6162, 0.0007, 1, 0.79, 0.2727, 732, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "remove_captures", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove_captures(self):\n self.subpattern = self.subpattern.remove_captures()\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2542_C8", "label": "self.subpattern = remove_captures()", "type": "assigned_variable", "loc": [2542, 2542], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2541_C4", "vector": [14, 2, 0.6162, 0.0002, 2, 0.85, 0.0, 131, 3, 0, 0, 0, 732, 10, 1], "semantic": {"name": "self.subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "remove_captures", "annotation": ""}, "snippet": " self.subpattern = self.subpattern.remove_captures()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2543_C8", "label": "return", "type": "return", "loc": [2543, 2543], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2541_C4", "vector": [13, 2, 0.6165, 0.0002, 2, 0.85, 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_1389:FunctionDef_L2545_C4", "label": "is_atomic", "type": "function", "loc": [2545, 2546], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "vector": [2, 1, 0.6171, 0.0005, 1, 0.79, 0.3636, 841, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "is_atomic", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_atomic(self):\n return self.subpattern.is_atomic()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2546_C8", "label": "return", "type": "return", "loc": [2546, 2546], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2545_C4", "vector": [13, 2, 0.6172, 0.0002, 2, 0.64, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.subpattern.is_atomic()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2548_C4", "label": "contains_group", "type": "function", "loc": [2548, 2549], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "vector": [2, 1, 0.6178, 0.0005, 1, 0.79, 0.4545, 206, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "contains_group", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def contains_group(self):\n return self.subpattern.contains_group()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2549_C8", "label": "return", "type": "return", "loc": [2549, 2549], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2548_C4", "vector": [13, 2, 0.6179, 0.0002, 2, 0.09, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.subpattern.contains_group()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2551_C4", "label": "_compile", "type": "function", "loc": [2551, 2572], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "vector": [2, 1, 0.621, 0.0053, 1, 0.79, 0.5455, 779, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n # The individual limits.\n arguments = []\n for e in \"dise\":\n v = self.constraints[e]\n arguments.append(v[0])\n arguments.append(UNLIMITED if v[1] is None else v[1])\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2553_C8", "label": "arguments =", "type": "assigned_variable", "loc": [2553, 2553], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2551_C4", "vector": [14, 2, 0.6189, 0.0002, 2, 0.66, 0.0, 426, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "arguments", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " arguments = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2554_C8", "label": "for e", "type": "for", "loc": [2554, 2557], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2551_C4", "vector": [6, 2, 0.6195, 0.001, 2, 0.66, 0.1429, 175, 1, 0, 0, 0, 0, 0, 2], "semantic": {"name": "e", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for e in \"dise\":\n v = self.constraints[e]\n arguments.append(v[0])\n arguments.append(UNLIMITED if v[1] is None else v[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2555_C12", "label": "v =", "type": "assigned_variable", "loc": [2555, 2555], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2554_C8", "vector": [14, 3, 0.6194, 0.0002, 3, 0.73, 0.0, 553, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " v = self.constraints[e]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2556_C12", "label": "append()", "type": "expression", "loc": [2556, 2556], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2554_C8", "vector": [8, 3, 0.6196, 0.0002, 3, 0.73, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " arguments.append(v[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2557_C12", "label": "append()", "type": "expression", "loc": [2557, 2557], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2554_C8", "vector": [8, 3, 0.6199, 0.0002, 3, 0.73, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " arguments.append(UNLIMITED if v[1] is None else v[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2560_C8", "label": "for e", "type": "for", "loc": [2560, 2561], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2551_C4", "vector": [6, 2, 0.6207, 0.0005, 2, 0.66, 0.2857, 175, 1, 0, 0, 0, 0, 0, 1], "semantic": {"name": "e", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for e in \"dis\":\n arguments.append(self.constraints[\"cost\"][e])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2561_C12", "label": "append()", "type": "expression", "loc": [2561, 2561], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2560_C8", "vector": [8, 3, 0.6208, 0.0002, 3, 0.53, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " arguments.append(self.constraints[\"cost\"][e])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2564_C8", "label": "v =", "type": "assigned_variable", "loc": [2564, 2564], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2551_C4", "vector": [14, 2, 0.6216, 0.0002, 2, 0.66, 0.4286, 553, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " v = self.constraints[\"cost\"][\"max\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2565_C8", "label": "append()", "type": "expression", "loc": [2565, 2565], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2551_C4", "vector": [8, 2, 0.6218, 0.0002, 2, 0.66, 0.5714, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " arguments.append(UNLIMITED if v is None else v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2567_C8", "label": "flags =", "type": "assigned_variable", "loc": [2567, 2567], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2551_C4", "vector": [14, 2, 0.6223, 0.0002, 2, 0.66, 0.7143, 375, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " flags = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2568_C8", "label": "if", "type": "if", "loc": [2568, 2569], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2551_C4", "vector": [4, 2, 0.6227, 0.0005, 2, 0.66, 0.8571, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if reverse:\n flags |= REVERSE_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2571_C8", "label": "return", "type": "return", "loc": [2571, 2572], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2551_C4", "vector": [13, 2, 0.6234, 0.0005, 2, 0.66, 1.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ([(OP.FUZZY, flags) + tuple(arguments)] +\n self.subpattern.compile(reverse, True) + [(OP.END,)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2574_C4", "label": "_dump", "type": "function", "loc": [2574, 2579], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "vector": [2, 1, 0.6246, 0.0015, 1, 0.79, 0.6364, 656, 0, 3, 0, 0, 0, 0, 4], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n constraints = self._constraints_to_string()\n if constraints:\n constraints = \" \" + constraints\n print(\"{}FUZZY{}\".format(INDENT * indent, constraints))\n self.subpattern.dump(indent + 1, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2575_C8", "label": "constraints = _constraints_to_string()", "type": "assigned_variable", "loc": [2575, 2575], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2574_C4", "vector": [14, 2, 0.6242, 0.0002, 2, 0.45, 0.0, 394, 3, 0, 0, 0, 702, 10, 1], "semantic": {"name": "constraints", "arg_names": [], "import_names": [], "rhs_call_name": "_constraints_to_string", "annotation": ""}, "snippet": " constraints = self._constraints_to_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2576_C8", "label": "if", "type": "if", "loc": [2576, 2577], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2574_C4", "vector": [4, 2, 0.6246, 0.0005, 2, 0.45, 0.3333, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if constraints:\n constraints = \" \" + constraints"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2577_C12", "label": "constraints =", "type": "assigned_variable", "loc": [2577, 2577], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2576_C8", "vector": [14, 3, 0.6247, 0.0002, 3, 0.88, 0.0, 394, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "constraints", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " constraints = \" \" + constraints"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2578_C8", "label": "print()", "type": "expression", "loc": [2578, 2578], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2574_C4", "vector": [8, 2, 0.625, 0.0002, 2, 0.45, 0.6667, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}FUZZY{}\".format(INDENT * indent, constraints))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2579_C8", "label": "dump()", "type": "expression", "loc": [2579, 2579], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2574_C4", "vector": [8, 2, 0.6252, 0.0002, 2, 0.45, 1.0, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " self.subpattern.dump(indent + 1, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2581_C4", "label": "is_empty", "type": "function", "loc": [2581, 2582], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "vector": [2, 1, 0.6258, 0.0005, 1, 0.79, 0.7273, 623, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "is_empty", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_empty(self):\n return self.subpattern.is_empty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2582_C8", "label": "return", "type": "return", "loc": [2582, 2582], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2581_C4", "vector": [13, 2, 0.6259, 0.0002, 2, 0.25, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.subpattern.is_empty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2584_C4", "label": "__eq__", "type": "function", "loc": [2584, 2586], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "vector": [2, 1, 0.6267, 0.0007, 1, 0.79, 0.8182, 763, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n return (type(self) is type(other) and self.subpattern ==\n other.subpattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2585_C8", "label": "return", "type": "return", "loc": [2585, 2586], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2584_C4", "vector": [13, 2, 0.6268, 0.0005, 2, 0.8, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (type(self) is type(other) and self.subpattern ==\n other.subpattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2588_C4", "label": "max_width", "type": "function", "loc": [2588, 2589], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "vector": [2, 1, 0.6275, 0.0005, 1, 0.79, 0.9091, 0, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "max_width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_width(self):\n return UNLIMITED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2589_C8", "label": "return", "type": "return", "loc": [2589, 2589], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2588_C4", "vector": [13, 2, 0.6276, 0.0002, 2, 0.08, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return UNLIMITED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2591_C4", "label": "_constraints_to_string", "type": "function", "loc": [2591, 2622], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "vector": [2, 1, 0.6319, 0.0078, 1, 0.79, 1.0, 702, 0, 1, 1, 0, 0, 0, 9], "semantic": {"name": "_constraints_to_string", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _constraints_to_string(self):\n constraints = []\n\n for name in \"ids\":\n min, max = self.constraints[name]\n if max == 0:\n continue\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2592_C8", "label": "constraints =", "type": "assigned_variable", "loc": [2592, 2592], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2591_C4", "vector": [14, 2, 0.6284, 0.0002, 2, 0.72, 0.0, 394, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "constraints", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " constraints = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2594_C8", "label": "for name", "type": "for", "loc": [2594, 2609], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2591_C4", "vector": [6, 2, 0.6307, 0.0039, 2, 0.72, 0.1667, 57, 1, 0, 0, 0, 0, 0, 3], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name in \"ids\":\n min, max = self.constraints[name]\n if max == 0:\n continue\n\n con = \"\"\n\n if min > 0:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2595_C12", "label": "min, max =", "type": "assigned_variable", "loc": [2595, 2595], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2594_C8", "vector": [14, 3, 0.6291, 0.0002, 3, 0.88, 0.0, 339, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "min, max", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " min, max = self.constraints[name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2596_C12", "label": "if", "type": "if", "loc": [2596, 2597], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2594_C8", "vector": [4, 3, 0.6295, 0.0005, 3, 0.88, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if max == 0:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2599_C12", "label": "con =", "type": "assigned_variable", "loc": [2599, 2599], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2594_C8", "vector": [14, 3, 0.6301, 0.0002, 3, 0.88, 0.4, 761, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " con = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2601_C12", "label": "if", "type": "if", "loc": [2601, 2602], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2594_C8", "vector": [4, 3, 0.6307, 0.0005, 3, 0.88, 0.6, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if min > 0:\n con = \"{}<=\".format(min)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2602_C16", "label": "con = format()", "type": "assigned_variable", "loc": [2602, 2602], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2601_C12", "vector": [14, 4, 0.6308, 0.0002, 4, 0.77, 0.0, 761, 3, 1, 0, 0, 293, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "format", "annotation": ""}, "snippet": " con = \"{}<=\".format(min)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2606_C12", "label": "if", "type": "if", "loc": [2606, 2607], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2594_C8", "vector": [4, 3, 0.6319, 0.0005, 3, 0.88, 0.8, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if max is not None:\n con += \"<={}\".format(max)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2609_C12", "label": "append()", "type": "expression", "loc": [2609, 2609], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2594_C8", "vector": [8, 3, 0.6325, 0.0002, 3, 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": " constraints.append(con)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2611_C8", "label": "cost =", "type": "assigned_variable", "loc": [2611, 2611], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2591_C4", "vector": [14, 2, 0.633, 0.0002, 2, 0.72, 0.3333, 454, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "cost", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cost = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2612_C8", "label": "for name", "type": "for", "loc": [2612, 2615], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2591_C4", "vector": [6, 2, 0.6336, 0.001, 2, 0.72, 0.5, 57, 1, 0, 0, 0, 0, 0, 2], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name in \"ids\":\n coeff = self.constraints[\"cost\"][name]\n if coeff > 0:\n cost.append(\"{}{}\".format(coeff, name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2613_C12", "label": "coeff =", "type": "assigned_variable", "loc": [2613, 2613], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2612_C8", "vector": [14, 3, 0.6335, 0.0002, 3, 0.11, 0.0, 81, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "coeff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " coeff = self.constraints[\"cost\"][name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2614_C12", "label": "if", "type": "if", "loc": [2614, 2615], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2612_C8", "vector": [4, 3, 0.6338, 0.0005, 3, 0.11, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if coeff > 0:\n cost.append(\"{}{}\".format(coeff, name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2615_C16", "label": "append()", "type": "expression", "loc": [2615, 2615], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2614_C12", "vector": [8, 4, 0.6339, 0.0002, 4, 0.63, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " cost.append(\"{}{}\".format(coeff, name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2617_C8", "label": "limit =", "type": "assigned_variable", "loc": [2617, 2617], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2591_C4", "vector": [14, 2, 0.6344, 0.0002, 2, 0.72, 0.6667, 429, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "limit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " limit = self.constraints[\"cost\"][\"max\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2618_C8", "label": "if", "type": "if", "loc": [2618, 2620], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2591_C4", "vector": [4, 2, 0.6349, 0.0007, 2, 0.72, 0.8333, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if limit is not None and limit > 0:\n cost = \"{}<={}\".format(\"+\".join(cost), limit)\n constraints.append(cost)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2619_C12", "label": "cost = format()", "type": "assigned_variable", "loc": [2619, 2619], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2618_C8", "vector": [14, 3, 0.6349, 0.0002, 3, 0.71, 0.0, 454, 3, 2, 0, 0, 293, 10, 2], "semantic": {"name": "cost", "arg_names": [], "import_names": [], "rhs_call_name": "format", "annotation": ""}, "snippet": " cost = \"{}<={}\".format(\"+\".join(cost), limit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2620_C12", "label": "append()", "type": "expression", "loc": [2620, 2620], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2618_C8", "vector": [8, 3, 0.6352, 0.0002, 3, 0.71, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " constraints.append(cost)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2622_C8", "label": "return", "type": "return", "loc": [2622, 2622], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2591_C4", "vector": [13, 2, 0.6356, 0.0002, 2, 0.72, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \",\".join(constraints)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2624_C0", "label": "Grapheme", "type": "class", "loc": [2624, 2638], "level": 0, "parent": null, "vector": [3, 0, 0.6378, 0.0036, 0, 0.66, 0.8187, 16, 0, 3, 0, 0, 852, 0, 5], "semantic": {"name": "Grapheme", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Grapheme(RegexBase):\n def _compile(self, reverse, fuzzy):\n # Match at least 1 character until a grapheme boundary is reached. Note\n # that this is the same whether matching forwards or backwards.\n character_matcher = LazyRepeat(AnyAll(), 1, None).compile(reverse,\n fuzzy)\n boundary_matcher = [(OP.GRAPHEME_BOUNDARY, 1)]\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2625_C4", "label": "_compile", "type": "function", "loc": [2625, 2632], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2624_C0", "vector": [2, 1, 0.6372, 0.0019, 1, 0.76, 0.0, 779, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n # Match at least 1 character until a grapheme boundary is reached. Note\n # that this is the same whether matching forwards or backwards.\n character_matcher = LazyRepeat(AnyAll(), 1, None).compile(reverse,\n fuzzy)\n boundary_matcher = [(OP.GRAPHEME_BOUNDARY, 1)]\n\n return character_matcher + boundary_matcher"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2628_C8", "label": "character_matcher = compile()", "type": "assigned_variable", "loc": [2628, 2629], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2625_C4", "vector": [14, 2, 0.6372, 0.0005, 2, 0.58, 0.0, 747, 3, 2, 0, 0, 821, 10, 3], "semantic": {"name": "character_matcher", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " character_matcher = LazyRepeat(AnyAll(), 1, None).compile(reverse,\n fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2630_C8", "label": "boundary_matcher =", "type": "assigned_variable", "loc": [2630, 2630], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2625_C4", "vector": [14, 2, 0.6376, 0.0002, 2, 0.58, 0.5, 316, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "boundary_matcher", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " boundary_matcher = [(OP.GRAPHEME_BOUNDARY, 1)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2632_C8", "label": "return", "type": "return", "loc": [2632, 2632], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2625_C4", "vector": [13, 2, 0.6381, 0.0002, 2, 0.58, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return character_matcher + boundary_matcher"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2634_C4", "label": "_dump", "type": "function", "loc": [2634, 2635], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2624_C0", "vector": [2, 1, 0.6387, 0.0005, 1, 0.76, 0.5, 656, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n print(\"{}GRAPHEME\".format(INDENT * indent))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2635_C8", "label": "print()", "type": "expression", "loc": [2635, 2635], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2634_C4", "vector": [8, 2, 0.6388, 0.0002, 2, 0.27, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}GRAPHEME\".format(INDENT * indent))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2637_C4", "label": "max_width", "type": "function", "loc": [2637, 2638], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2624_C0", "vector": [2, 1, 0.6394, 0.0005, 1, 0.76, 1.0, 0, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "max_width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_width(self):\n return UNLIMITED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2638_C8", "label": "return", "type": "return", "loc": [2638, 2638], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2637_C4", "vector": [13, 2, 0.6395, 0.0002, 2, 0.19, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return UNLIMITED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "label": "GreedyRepeat", "type": "class", "loc": [2640, 2727], "level": 0, "parent": null, "vector": [3, 0, 0.6505, 0.0213, 0, 0.66, 0.8238, 24, 0, 14, 0, 0, 852, 0, 27], "semantic": {"name": "GreedyRepeat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GreedyRepeat(RegexBase):\n _opcode = OP.GREEDY_REPEAT\n _op_name = \"GREEDY_REPEAT\"\n\n def __init__(self, subpattern, min_count, max_count):\n RegexBase.__init__(self)\n self.subpattern = subpattern\n self.min_count = min_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2641_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [2641, 2641], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "vector": [14, 1, 0.6402, 0.0002, 1, 0.0, 0.0, 52, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = OP.GREEDY_REPEAT"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2642_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [2642, 2642], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "vector": [14, 1, 0.6405, 0.0002, 1, 0.0, 0.0667, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"GREEDY_REPEAT\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2644_C4", "label": "__init__", "type": "function", "loc": [2644, 2648], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "vector": [2, 1, 0.6415, 0.0012, 1, 0.0, 0.1333, 555, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "subpattern", "min_count", "max_count"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, subpattern, min_count, max_count):\n RegexBase.__init__(self)\n self.subpattern = subpattern\n self.min_count = min_count\n self.max_count = max_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2645_C8", "label": "__init__()", "type": "expression", "loc": [2645, 2645], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2644_C4", "vector": [8, 2, 0.6412, 0.0002, 2, 0.72, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " RegexBase.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2646_C8", "label": "self.subpattern =", "type": "assigned_variable", "loc": [2646, 2646], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2644_C4", "vector": [14, 2, 0.6415, 0.0002, 2, 0.72, 0.3333, 131, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.subpattern = subpattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2647_C8", "label": "self.min_count =", "type": "assigned_variable", "loc": [2647, 2647], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2644_C4", "vector": [14, 2, 0.6417, 0.0002, 2, 0.72, 0.6667, 316, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.min_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.min_count = min_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2648_C8", "label": "self.max_count =", "type": "assigned_variable", "loc": [2648, 2648], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2644_C4", "vector": [14, 2, 0.6419, 0.0002, 2, 0.72, 1.0, 366, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.max_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.max_count = max_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2650_C4", "label": "fix_groups", "type": "function", "loc": [2650, 2651], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "vector": [2, 1, 0.6425, 0.0005, 1, 0.0, 0.2, 269, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "fix_groups", "arg_names": ["self", "pattern", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fix_groups(self, pattern, reverse, fuzzy):\n self.subpattern.fix_groups(pattern, reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2651_C8", "label": "fix_groups()", "type": "expression", "loc": [2651, 2651], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2650_C4", "vector": [8, 2, 0.6427, 0.0002, 2, 0.33, 0.0, 269, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "fix_groups", "arg_names": [], "import_names": [], "rhs_call_name": "fix_groups", "annotation": ""}, "snippet": " self.subpattern.fix_groups(pattern, reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2653_C4", "label": "optimise", "type": "function", "loc": [2653, 2656], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "vector": [2, 1, 0.6435, 0.001, 1, 0.0, 0.2667, 265, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "optimise", "arg_names": ["self", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def optimise(self, info):\n subpattern = self.subpattern.optimise(info)\n\n return type(self)(subpattern, self.min_count, self.max_count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2654_C8", "label": "subpattern = optimise()", "type": "assigned_variable", "loc": [2654, 2654], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2653_C4", "vector": [14, 2, 0.6434, 0.0002, 2, 0.07, 0.0, 276, 3, 1, 0, 0, 265, 10, 1], "semantic": {"name": "subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "optimise", "annotation": ""}, "snippet": " subpattern = self.subpattern.optimise(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2656_C8", "label": "return", "type": "return", "loc": [2656, 2656], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2653_C4", "vector": [13, 2, 0.6439, 0.0002, 2, 0.07, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return type(self)(subpattern, self.min_count, self.max_count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2658_C4", "label": "pack_characters", "type": "function", "loc": [2658, 2660], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "vector": [2, 1, 0.6446, 0.0007, 1, 0.0, 0.3333, 434, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "pack_characters", "arg_names": ["self", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pack_characters(self, info):\n self.subpattern = self.subpattern.pack_characters(info)\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2659_C8", "label": "self.subpattern = pack_characters()", "type": "assigned_variable", "loc": [2659, 2659], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2658_C4", "vector": [14, 2, 0.6446, 0.0002, 2, 0.67, 0.0, 131, 3, 1, 0, 0, 434, 10, 1], "semantic": {"name": "self.subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "pack_characters", "annotation": ""}, "snippet": " self.subpattern = self.subpattern.pack_characters(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2660_C8", "label": "return", "type": "return", "loc": [2660, 2660], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2658_C4", "vector": [13, 2, 0.6448, 0.0002, 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_1389:FunctionDef_L2662_C4", "label": "remove_captures", "type": "function", "loc": [2662, 2664], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "vector": [2, 1, 0.6456, 0.0007, 1, 0.0, 0.4, 732, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "remove_captures", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove_captures(self):\n self.subpattern = self.subpattern.remove_captures()\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2663_C8", "label": "self.subpattern = remove_captures()", "type": "assigned_variable", "loc": [2663, 2663], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2662_C4", "vector": [14, 2, 0.6456, 0.0002, 2, 0.85, 0.0, 131, 3, 0, 0, 0, 732, 10, 1], "semantic": {"name": "self.subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "remove_captures", "annotation": ""}, "snippet": " self.subpattern = self.subpattern.remove_captures()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2664_C8", "label": "return", "type": "return", "loc": [2664, 2664], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2662_C4", "vector": [13, 2, 0.6458, 0.0002, 2, 0.85, 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_1389:FunctionDef_L2666_C4", "label": "is_atomic", "type": "function", "loc": [2666, 2667], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "vector": [2, 1, 0.6464, 0.0005, 1, 0.0, 0.4667, 841, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "is_atomic", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_atomic(self):\n return self.min_count == self.max_count and self.subpattern.is_atomic()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2667_C8", "label": "return", "type": "return", "loc": [2667, 2667], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2666_C4", "vector": [13, 2, 0.6465, 0.0002, 2, 0.81, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.min_count == self.max_count and self.subpattern.is_atomic()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2669_C4", "label": "contains_group", "type": "function", "loc": [2669, 2670], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "vector": [2, 1, 0.6472, 0.0005, 1, 0.0, 0.5333, 206, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "contains_group", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def contains_group(self):\n return self.subpattern.contains_group()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2670_C8", "label": "return", "type": "return", "loc": [2670, 2670], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2669_C4", "vector": [13, 2, 0.6473, 0.0002, 2, 0.95, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.subpattern.contains_group()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2672_C4", "label": "get_firstset", "type": "function", "loc": [2672, 2677], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "vector": [2, 1, 0.6484, 0.0015, 1, 0.0, 0.6, 638, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "get_firstset", "arg_names": ["self", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_firstset(self, reverse):\n fs = self.subpattern.get_firstset(reverse)\n if self.min_count == 0:\n fs.add(None)\n\n return fs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2673_C8", "label": "fs = get_firstset()", "type": "assigned_variable", "loc": [2673, 2673], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2672_C4", "vector": [14, 2, 0.648, 0.0002, 2, 0.41, 0.0, 245, 3, 1, 0, 0, 638, 10, 1], "semantic": {"name": "fs", "arg_names": [], "import_names": [], "rhs_call_name": "get_firstset", "annotation": ""}, "snippet": " fs = self.subpattern.get_firstset(reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2674_C8", "label": "if", "type": "if", "loc": [2674, 2675], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2672_C4", "vector": [4, 2, 0.6484, 0.0005, 2, 0.41, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.min_count == 0:\n fs.add(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2675_C12", "label": "add()", "type": "expression", "loc": [2675, 2675], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2674_C8", "vector": [8, 3, 0.6485, 0.0002, 3, 0.4, 0.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " fs.add(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2677_C8", "label": "return", "type": "return", "loc": [2677, 2677], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2672_C4", "vector": [13, 2, 0.649, 0.0002, 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 fs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2679_C4", "label": "_compile", "type": "function", "loc": [2679, 2690], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "vector": [2, 1, 0.6508, 0.0029, 1, 0.0, 0.6667, 779, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n repeat = [self._opcode, self.min_count]\n if self.max_count is None:\n repeat.append(UNLIMITED)\n else:\n repeat.append(self.max_count)\n\n subpattern = self.subpattern.compile(reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2680_C8", "label": "repeat =", "type": "assigned_variable", "loc": [2680, 2680], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2679_C4", "vector": [14, 2, 0.6497, 0.0002, 2, 0.58, 0.0, 522, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "repeat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " repeat = [self._opcode, self.min_count]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2681_C8", "label": "if", "type": "if", "loc": [2681, 2684], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2679_C4", "vector": [4, 2, 0.6503, 0.001, 2, 0.58, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.max_count is None:\n repeat.append(UNLIMITED)\n else:\n repeat.append(self.max_count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2682_C12", "label": "append()", "type": "expression", "loc": [2682, 2682], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2681_C8", "vector": [8, 3, 0.6502, 0.0002, 3, 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": " repeat.append(UNLIMITED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2684_C12", "label": "append()", "type": "expression", "loc": [2684, 2684], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2681_C8", "vector": [8, 3, 0.6507, 0.0002, 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": " repeat.append(self.max_count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2686_C8", "label": "subpattern = compile()", "type": "assigned_variable", "loc": [2686, 2686], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2679_C4", "vector": [14, 2, 0.6512, 0.0002, 2, 0.58, 0.5, 276, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " subpattern = self.subpattern.compile(reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2687_C8", "label": "if", "type": "if", "loc": [2687, 2688], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2679_C4", "vector": [4, 2, 0.6515, 0.0005, 2, 0.58, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not subpattern:\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2688_C12", "label": "return", "type": "return", "loc": [2688, 2688], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2687_C8", "vector": [13, 3, 0.6516, 0.0002, 3, 0.9, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2690_C8", "label": "return", "type": "return", "loc": [2690, 2690], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2679_C4", "vector": [13, 2, 0.6521, 0.0002, 2, 0.58, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ([tuple(repeat)] + subpattern + [(OP.END, )])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2692_C4", "label": "_dump", "type": "function", "loc": [2692, 2700], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "vector": [2, 1, 0.6536, 0.0022, 1, 0.0, 0.7333, 656, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n if self.max_count is None:\n limit = \"INF\"\n else:\n limit = self.max_count\n print(\"{}{} {} {}\".format(INDENT * indent, self._op_name,\n self.min_count, limit))\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2693_C8", "label": "if", "type": "if", "loc": [2693, 2696], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2692_C4", "vector": [4, 2, 0.6532, 0.001, 2, 0.21, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.max_count is None:\n limit = \"INF\"\n else:\n limit = self.max_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2694_C12", "label": "limit =", "type": "assigned_variable", "loc": [2694, 2694], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2693_C8", "vector": [14, 3, 0.6531, 0.0002, 3, 0.92, 0.0, 429, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "limit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " limit = \"INF\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2696_C12", "label": "limit =", "type": "assigned_variable", "loc": [2696, 2696], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2693_C8", "vector": [14, 3, 0.6536, 0.0002, 3, 0.92, 1.0, 429, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "limit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " limit = self.max_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2697_C8", "label": "print()", "type": "expression", "loc": [2697, 2698], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2692_C4", "vector": [8, 2, 0.6539, 0.0005, 2, 0.21, 0.5, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}{} {} {}\".format(INDENT * indent, self._op_name,\n self.min_count, limit))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2700_C8", "label": "dump()", "type": "expression", "loc": [2700, 2700], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2692_C4", "vector": [8, 2, 0.6545, 0.0002, 2, 0.21, 1.0, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " self.subpattern.dump(indent + 1, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2702_C4", "label": "is_empty", "type": "function", "loc": [2702, 2703], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "vector": [2, 1, 0.6552, 0.0005, 1, 0.0, 0.8, 623, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "is_empty", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_empty(self):\n return self.subpattern.is_empty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2703_C8", "label": "return", "type": "return", "loc": [2703, 2703], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2702_C4", "vector": [13, 2, 0.6553, 0.0002, 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 self.subpattern.is_empty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2705_C4", "label": "__eq__", "type": "function", "loc": [2705, 2708], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "vector": [2, 1, 0.6561, 0.001, 1, 0.0, 0.8667, 763, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n return type(self) is type(other) and (self.subpattern, self.min_count,\n self.max_count) == (other.subpattern, other.min_count,\n other.max_count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2706_C8", "label": "return", "type": "return", "loc": [2706, 2708], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2705_C4", "vector": [13, 2, 0.6562, 0.0007, 2, 0.9, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return type(self) is type(other) and (self.subpattern, self.min_count,\n self.max_count) == (other.subpattern, other.min_count,\n other.max_count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2710_C4", "label": "max_width", "type": "function", "loc": [2710, 2714], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "vector": [2, 1, 0.6575, 0.0012, 1, 0.0, 0.9333, 0, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "max_width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_width(self):\n if self.max_count is None:\n return UNLIMITED\n\n return self.subpattern.max_width() * self.max_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2711_C8", "label": "if", "type": "if", "loc": [2711, 2712], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2710_C4", "vector": [4, 2, 0.6573, 0.0005, 2, 0.04, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.max_count is None:\n return UNLIMITED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2712_C12", "label": "return", "type": "return", "loc": [2712, 2712], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2711_C8", "vector": [13, 3, 0.6575, 0.0002, 3, 0.61, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return UNLIMITED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2714_C8", "label": "return", "type": "return", "loc": [2714, 2714], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2710_C4", "vector": [13, 2, 0.6579, 0.0002, 2, 0.04, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.subpattern.max_width() * self.max_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2716_C4", "label": "get_required_string", "type": "function", "loc": [2716, 2727], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "vector": [2, 1, 0.6598, 0.0029, 1, 0.0, 1.0, 720, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "get_required_string", "arg_names": ["self", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_required_string(self, reverse):\n max_count = UNLIMITED if self.max_count is None else self.max_count\n if self.min_count == 0:\n w = self.subpattern.max_width() * max_count\n return min(w, UNLIMITED), None\n\n ofs, req = self.subpattern.get_required_string(reverse)\n if req:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2717_C8", "label": "max_count =", "type": "assigned_variable", "loc": [2717, 2717], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2716_C4", "vector": [14, 2, 0.6587, 0.0002, 2, 0.51, 0.0, 632, 8, 0, 0, 0, 0, 0, 0], "semantic": {"name": "max_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_count = UNLIMITED if self.max_count is None else self.max_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2718_C8", "label": "if", "type": "if", "loc": [2718, 2720], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2716_C4", "vector": [4, 2, 0.6592, 0.0007, 2, 0.51, 0.2, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.min_count == 0:\n w = self.subpattern.max_width() * max_count\n return min(w, UNLIMITED), None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2719_C12", "label": "w =", "type": "assigned_variable", "loc": [2719, 2719], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2718_C8", "vector": [14, 3, 0.6592, 0.0002, 3, 0.1, 0.0, 549, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w = self.subpattern.max_width() * max_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2720_C12", "label": "return", "type": "return", "loc": [2720, 2720], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2718_C8", "vector": [13, 3, 0.6594, 0.0002, 3, 0.1, 1.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return min(w, UNLIMITED), None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2722_C8", "label": "ofs, req = get_required_string()", "type": "assigned_variable", "loc": [2722, 2722], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2716_C4", "vector": [14, 2, 0.6599, 0.0002, 2, 0.51, 0.4, 354, 3, 1, 0, 0, 720, 10, 1], "semantic": {"name": "ofs, req", "arg_names": [], "import_names": [], "rhs_call_name": "get_required_string", "annotation": ""}, "snippet": " ofs, req = self.subpattern.get_required_string(reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2723_C8", "label": "if", "type": "if", "loc": [2723, 2724], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2716_C4", "vector": [4, 2, 0.6602, 0.0005, 2, 0.51, 0.6, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if req:\n return ofs, req"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2724_C12", "label": "return", "type": "return", "loc": [2724, 2724], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2723_C8", "vector": [13, 3, 0.6604, 0.0002, 3, 0.79, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ofs, req"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2726_C8", "label": "w =", "type": "assigned_variable", "loc": [2726, 2726], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2716_C4", "vector": [14, 2, 0.6608, 0.0002, 2, 0.51, 0.8, 549, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w = self.subpattern.max_width() * max_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2727_C8", "label": "return", "type": "return", "loc": [2727, 2727], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2716_C4", "vector": [13, 2, 0.6611, 0.0002, 2, 0.51, 1.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return min(w, UNLIMITED), None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "label": "Group", "type": "class", "loc": [2729, 2805], "level": 0, "parent": null, "vector": [3, 0, 0.6708, 0.0187, 0, 0.66, 0.829, 536, 0, 15, 0, 0, 852, 0, 18], "semantic": {"name": "Group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Group(RegexBase):\n def __init__(self, info, group, subpattern):\n RegexBase.__init__(self)\n self.info = info\n self.group = group\n self.subpattern = subpattern\n\n self.call_ref = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2730_C4", "label": "__init__", "type": "function", "loc": [2730, 2736], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "vector": [2, 1, 0.6625, 0.0017, 1, 0.95, 0.0, 555, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "info", "group", "subpattern"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, info, group, subpattern):\n RegexBase.__init__(self)\n self.info = info\n self.group = group\n self.subpattern = subpattern\n\n self.call_ref = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2731_C8", "label": "__init__()", "type": "expression", "loc": [2731, 2731], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2730_C4", "vector": [8, 2, 0.6621, 0.0002, 2, 0.37, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " RegexBase.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2732_C8", "label": "self.info =", "type": "assigned_variable", "loc": [2732, 2732], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2730_C4", "vector": [14, 2, 0.6623, 0.0002, 2, 0.37, 0.25, 264, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.info = info"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2733_C8", "label": "self.group =", "type": "assigned_variable", "loc": [2733, 2733], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2730_C4", "vector": [14, 2, 0.6625, 0.0002, 2, 0.37, 0.5, 561, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.group = group"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2734_C8", "label": "self.subpattern =", "type": "assigned_variable", "loc": [2734, 2734], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2730_C4", "vector": [14, 2, 0.6628, 0.0002, 2, 0.37, 0.75, 131, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.subpattern = subpattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2736_C8", "label": "self.call_ref =", "type": "assigned_variable", "loc": [2736, 2736], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2730_C4", "vector": [14, 2, 0.6633, 0.0002, 2, 0.37, 1.0, 233, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.call_ref", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.call_ref = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2738_C4", "label": "fix_groups", "type": "function", "loc": [2738, 2740], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "vector": [2, 1, 0.664, 0.0007, 1, 0.95, 0.0714, 269, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "fix_groups", "arg_names": ["self", "pattern", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fix_groups(self, pattern, reverse, fuzzy):\n self.info.defined_groups[self.group] = (self, reverse, fuzzy)\n self.subpattern.fix_groups(pattern, reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2739_C8", "label": "assign", "type": "assigned_variable", "loc": [2739, 2739], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2738_C4", "vector": [14, 2, 0.664, 0.0002, 2, 0.47, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.info.defined_groups[self.group] = (self, reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2740_C8", "label": "fix_groups()", "type": "expression", "loc": [2740, 2740], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2738_C4", "vector": [8, 2, 0.6642, 0.0002, 2, 0.47, 1.0, 269, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "fix_groups", "arg_names": [], "import_names": [], "rhs_call_name": "fix_groups", "annotation": ""}, "snippet": " self.subpattern.fix_groups(pattern, reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2742_C4", "label": "optimise", "type": "function", "loc": [2742, 2745], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "vector": [2, 1, 0.6651, 0.001, 1, 0.95, 0.1429, 265, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "optimise", "arg_names": ["self", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def optimise(self, info):\n subpattern = self.subpattern.optimise(info)\n\n return Group(self.info, self.group, subpattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2743_C8", "label": "subpattern = optimise()", "type": "assigned_variable", "loc": [2743, 2743], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2742_C4", "vector": [14, 2, 0.665, 0.0002, 2, 0.69, 0.0, 276, 3, 1, 0, 0, 265, 10, 1], "semantic": {"name": "subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "optimise", "annotation": ""}, "snippet": " subpattern = self.subpattern.optimise(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2745_C8", "label": "return", "type": "return", "loc": [2745, 2745], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2742_C4", "vector": [13, 2, 0.6655, 0.0002, 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 Group(self.info, self.group, subpattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2747_C4", "label": "pack_characters", "type": "function", "loc": [2747, 2749], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "vector": [2, 1, 0.6662, 0.0007, 1, 0.95, 0.2143, 434, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "pack_characters", "arg_names": ["self", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pack_characters(self, info):\n self.subpattern = self.subpattern.pack_characters(info)\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2748_C8", "label": "self.subpattern = pack_characters()", "type": "assigned_variable", "loc": [2748, 2748], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2747_C4", "vector": [14, 2, 0.6662, 0.0002, 2, 0.34, 0.0, 131, 3, 1, 0, 0, 434, 10, 1], "semantic": {"name": "self.subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "pack_characters", "annotation": ""}, "snippet": " self.subpattern = self.subpattern.pack_characters(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2749_C8", "label": "return", "type": "return", "loc": [2749, 2749], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2747_C4", "vector": [13, 2, 0.6664, 0.0002, 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 self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2751_C4", "label": "remove_captures", "type": "function", "loc": [2751, 2752], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "vector": [2, 1, 0.667, 0.0005, 1, 0.95, 0.2857, 732, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "remove_captures", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove_captures(self):\n return self.subpattern.remove_captures()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2752_C8", "label": "return", "type": "return", "loc": [2752, 2752], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2751_C4", "vector": [13, 2, 0.6672, 0.0002, 2, 0.28, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.subpattern.remove_captures()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2754_C4", "label": "is_atomic", "type": "function", "loc": [2754, 2755], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "vector": [2, 1, 0.6678, 0.0005, 1, 0.95, 0.3571, 841, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "is_atomic", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_atomic(self):\n return self.subpattern.is_atomic()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2755_C8", "label": "return", "type": "return", "loc": [2755, 2755], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2754_C4", "vector": [13, 2, 0.6679, 0.0002, 2, 0.6, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.subpattern.is_atomic()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2757_C4", "label": "can_be_affix", "type": "function", "loc": [2757, 2758], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "vector": [2, 1, 0.6685, 0.0005, 1, 0.95, 0.4286, 276, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "can_be_affix", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def can_be_affix(self):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2758_C8", "label": "return", "type": "return", "loc": [2758, 2758], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2757_C4", "vector": [13, 2, 0.6686, 0.0002, 2, 0.47, 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_1389:FunctionDef_L2760_C4", "label": "contains_group", "type": "function", "loc": [2760, 2761], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "vector": [2, 1, 0.6692, 0.0005, 1, 0.95, 0.5, 206, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "contains_group", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def contains_group(self):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2761_C8", "label": "return", "type": "return", "loc": [2761, 2761], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2760_C4", "vector": [13, 2, 0.6693, 0.0002, 2, 0.75, 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_1389:FunctionDef_L2763_C4", "label": "get_firstset", "type": "function", "loc": [2763, 2764], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "vector": [2, 1, 0.6699, 0.0005, 1, 0.95, 0.5714, 638, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_firstset", "arg_names": ["self", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_firstset(self, reverse):\n return self.subpattern.get_firstset(reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2764_C8", "label": "return", "type": "return", "loc": [2764, 2764], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2763_C4", "vector": [13, 2, 0.6701, 0.0002, 2, 0.06, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.subpattern.get_firstset(reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2766_C4", "label": "has_simple_start", "type": "function", "loc": [2766, 2767], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "vector": [2, 1, 0.6707, 0.0005, 1, 0.95, 0.6429, 317, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "has_simple_start", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def has_simple_start(self):\n return self.subpattern.has_simple_start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2767_C8", "label": "return", "type": "return", "loc": [2767, 2767], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2766_C4", "vector": [13, 2, 0.6708, 0.0002, 2, 0.87, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.subpattern.has_simple_start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2769_C4", "label": "_compile", "type": "function", "loc": [2769, 2788], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "vector": [2, 1, 0.6736, 0.0048, 1, 0.95, 0.7143, 779, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n code = []\n\n key = self.group, reverse, fuzzy\n ref = self.info.call_refs.get(key)\n if ref is not None:\n code += [(OP.CALL_REF, ref)]\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2770_C8", "label": "code =", "type": "assigned_variable", "loc": [2770, 2770], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2769_C4", "vector": [14, 2, 0.6715, 0.0002, 2, 0.67, 0.0, 44, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " code = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2772_C8", "label": "key =", "type": "assigned_variable", "loc": [2772, 2772], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2769_C4", "vector": [14, 2, 0.672, 0.0002, 2, 0.67, 0.1429, 230, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = self.group, reverse, fuzzy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2773_C8", "label": "ref = get()", "type": "assigned_variable", "loc": [2773, 2773], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2769_C4", "vector": [14, 2, 0.6722, 0.0002, 2, 0.67, 0.2857, 686, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "ref", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ref = self.info.call_refs.get(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2774_C8", "label": "if", "type": "if", "loc": [2774, 2775], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2769_C4", "vector": [4, 2, 0.6726, 0.0005, 2, 0.67, 0.4286, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ref is not None:\n code += [(OP.CALL_REF, ref)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2777_C8", "label": "public_group =", "type": "assigned_variable", "loc": [2777, 2777], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2769_C4", "vector": [14, 2, 0.6732, 0.0002, 2, 0.67, 0.5714, 422, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "public_group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " public_group = private_group = self.group"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2778_C8", "label": "if", "type": "if", "loc": [2778, 2780], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2769_C4", "vector": [4, 2, 0.6737, 0.0007, 2, 0.67, 0.7143, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if private_group < 0:\n public_group = self.info.private_groups[private_group]\n private_group = self.info.group_count - private_group"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2779_C12", "label": "public_group =", "type": "assigned_variable", "loc": [2779, 2779], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2778_C8", "vector": [14, 3, 0.6737, 0.0002, 3, 0.76, 0.0, 422, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "public_group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " public_group = self.info.private_groups[private_group]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2780_C12", "label": "private_group =", "type": "assigned_variable", "loc": [2780, 2780], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2778_C8", "vector": [14, 3, 0.6739, 0.0002, 3, 0.76, 1.0, 770, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "private_group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " private_group = self.info.group_count - private_group"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2785_C8", "label": "if", "type": "if", "loc": [2785, 2786], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2769_C4", "vector": [4, 2, 0.6753, 0.0005, 2, 0.67, 0.8571, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ref is not None:\n code += [(OP.END, )]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2788_C8", "label": "return", "type": "return", "loc": [2788, 2788], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2769_C4", "vector": [13, 2, 0.6759, 0.0002, 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 code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2790_C4", "label": "_dump", "type": "function", "loc": [2790, 2795], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "vector": [2, 1, 0.677, 0.0015, 1, 0.95, 0.7857, 656, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n group = self.group\n if group < 0:\n group = private_groups[group]\n print(\"{}GROUP {}\".format(INDENT * indent, group))\n self.subpattern.dump(indent + 1, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2791_C8", "label": "group =", "type": "assigned_variable", "loc": [2791, 2791], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2790_C4", "vector": [14, 2, 0.6766, 0.0002, 2, 0.77, 0.0, 43, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " group = self.group"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2792_C8", "label": "if", "type": "if", "loc": [2792, 2793], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2790_C4", "vector": [4, 2, 0.677, 0.0005, 2, 0.77, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if group < 0:\n group = private_groups[group]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2793_C12", "label": "group =", "type": "assigned_variable", "loc": [2793, 2793], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2792_C8", "vector": [14, 3, 0.6771, 0.0002, 3, 0.8, 0.0, 43, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " group = private_groups[group]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2794_C8", "label": "print()", "type": "expression", "loc": [2794, 2794], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2790_C4", "vector": [8, 2, 0.6773, 0.0002, 2, 0.77, 0.6667, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}GROUP {}\".format(INDENT * indent, group))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2795_C8", "label": "dump()", "type": "expression", "loc": [2795, 2795], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2790_C4", "vector": [8, 2, 0.6776, 0.0002, 2, 0.77, 1.0, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " self.subpattern.dump(indent + 1, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2797_C4", "label": "__eq__", "type": "function", "loc": [2797, 2799], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "vector": [2, 1, 0.6783, 0.0007, 1, 0.95, 0.8571, 763, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n return (type(self) is type(other) and (self.group, self.subpattern) ==\n (other.group, other.subpattern))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2798_C8", "label": "return", "type": "return", "loc": [2798, 2799], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2797_C4", "vector": [13, 2, 0.6784, 0.0005, 2, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (type(self) is type(other) and (self.group, self.subpattern) ==\n (other.group, other.subpattern))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2801_C4", "label": "max_width", "type": "function", "loc": [2801, 2802], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "vector": [2, 1, 0.6792, 0.0005, 1, 0.95, 0.9286, 0, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "max_width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_width(self):\n return self.subpattern.max_width()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2802_C8", "label": "return", "type": "return", "loc": [2802, 2802], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2801_C4", "vector": [13, 2, 0.6793, 0.0002, 2, 0.97, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.subpattern.max_width()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2804_C4", "label": "get_required_string", "type": "function", "loc": [2804, 2805], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "vector": [2, 1, 0.6799, 0.0005, 1, 0.95, 1.0, 720, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_required_string", "arg_names": ["self", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_required_string(self, reverse):\n return self.subpattern.get_required_string(reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2805_C8", "label": "return", "type": "return", "loc": [2805, 2805], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2804_C4", "vector": [13, 2, 0.68, 0.0002, 2, 0.02, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.subpattern.get_required_string(reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2807_C0", "label": "LazyRepeat", "type": "class", "loc": [2807, 2809], "level": 0, "parent": null, "vector": [3, 0, 0.6807, 0.0007, 0, 0.66, 0.8342, 245, 0, 0, 0, 0, 24, 0, 0], "semantic": {"name": "LazyRepeat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class LazyRepeat(GreedyRepeat):\n _opcode = OP.LAZY_REPEAT\n _op_name = \"LAZY_REPEAT\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2808_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [2808, 2808], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2807_C0", "vector": [14, 1, 0.6807, 0.0002, 1, 0.75, 0.0, 52, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = OP.LAZY_REPEAT"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2809_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [2809, 2809], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2807_C0", "vector": [14, 1, 0.681, 0.0002, 1, 0.75, 1.0, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"LAZY_REPEAT\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "label": "LookAround", "type": "class", "loc": [2811, 2867], "level": 0, "parent": null, "vector": [3, 0, 0.6882, 0.0138, 0, 0.66, 0.8394, 768, 0, 14, 0, 0, 852, 0, 22], "semantic": {"name": "LookAround", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class LookAround(RegexBase):\n _dir_text = {False: \"AHEAD\", True: \"BEHIND\"}\n\n def __new__(cls, behind, positive, subpattern):\n if positive and subpattern.is_empty():\n return subpattern\n\n return RegexBase.__new__(cls)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2812_C4", "label": "_dir_text =", "type": "assigned_variable", "loc": [2812, 2812], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "vector": [14, 1, 0.6817, 0.0002, 1, 0.91, 0.0, 13, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_dir_text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _dir_text = {False: \"AHEAD\", True: \"BEHIND\"}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2814_C4", "label": "__new__", "type": "function", "loc": [2814, 2818], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "vector": [2, 1, 0.6827, 0.0012, 1, 0.91, 0.0714, 42, 0, 4, 1, 0, 0, 0, 2], "semantic": {"name": "__new__", "arg_names": ["cls", "behind", "positive", "subpattern"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __new__(cls, behind, positive, subpattern):\n if positive and subpattern.is_empty():\n return subpattern\n\n return RegexBase.__new__(cls)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2815_C8", "label": "if", "type": "if", "loc": [2815, 2816], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2814_C4", "vector": [4, 2, 0.6825, 0.0005, 2, 0.3, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if positive and subpattern.is_empty():\n return subpattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2816_C12", "label": "return", "type": "return", "loc": [2816, 2816], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2815_C8", "vector": [13, 3, 0.6827, 0.0002, 3, 0.08, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return subpattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2818_C8", "label": "return", "type": "return", "loc": [2818, 2818], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2814_C4", "vector": [13, 2, 0.6832, 0.0002, 2, 0.3, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return RegexBase.__new__(cls)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2820_C4", "label": "__init__", "type": "function", "loc": [2820, 2824], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "vector": [2, 1, 0.6841, 0.0012, 1, 0.91, 0.1429, 555, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "behind", "positive", "subpattern"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, behind, positive, subpattern):\n RegexBase.__init__(self)\n self.behind = bool(behind)\n self.positive = bool(positive)\n self.subpattern = subpattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2821_C8", "label": "__init__()", "type": "expression", "loc": [2821, 2821], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2820_C4", "vector": [8, 2, 0.6839, 0.0002, 2, 0.29, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " RegexBase.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2822_C8", "label": "self.behind = bool()", "type": "assigned_variable", "loc": [2822, 2822], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2820_C4", "vector": [14, 2, 0.6841, 0.0002, 2, 0.29, 0.3333, 761, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "self.behind", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " self.behind = bool(behind)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2823_C8", "label": "self.positive = bool()", "type": "assigned_variable", "loc": [2823, 2823], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2820_C4", "vector": [14, 2, 0.6844, 0.0002, 2, 0.29, 0.6667, 226, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "self.positive", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " self.positive = bool(positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2824_C8", "label": "self.subpattern =", "type": "assigned_variable", "loc": [2824, 2824], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2820_C4", "vector": [14, 2, 0.6846, 0.0002, 2, 0.29, 1.0, 131, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.subpattern = subpattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2826_C4", "label": "fix_groups", "type": "function", "loc": [2826, 2827], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "vector": [2, 1, 0.6852, 0.0005, 1, 0.91, 0.2143, 269, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "fix_groups", "arg_names": ["self", "pattern", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fix_groups(self, pattern, reverse, fuzzy):\n self.subpattern.fix_groups(pattern, self.behind, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2827_C8", "label": "fix_groups()", "type": "expression", "loc": [2827, 2827], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2826_C4", "vector": [8, 2, 0.6853, 0.0002, 2, 0.5, 0.0, 269, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "fix_groups", "arg_names": [], "import_names": [], "rhs_call_name": "fix_groups", "annotation": ""}, "snippet": " self.subpattern.fix_groups(pattern, self.behind, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2829_C4", "label": "optimise", "type": "function", "loc": [2829, 2832], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "vector": [2, 1, 0.6862, 0.001, 1, 0.91, 0.2857, 265, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "optimise", "arg_names": ["self", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def optimise(self, info):\n subpattern = self.subpattern.optimise(info)\n\n return LookAround(self.behind, self.positive, subpattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2830_C8", "label": "subpattern = optimise()", "type": "assigned_variable", "loc": [2830, 2830], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2829_C4", "vector": [14, 2, 0.6861, 0.0002, 2, 0.95, 0.0, 276, 3, 1, 0, 0, 265, 10, 1], "semantic": {"name": "subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "optimise", "annotation": ""}, "snippet": " subpattern = self.subpattern.optimise(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2832_C8", "label": "return", "type": "return", "loc": [2832, 2832], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2829_C4", "vector": [13, 2, 0.6865, 0.0002, 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 LookAround(self.behind, self.positive, subpattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2834_C4", "label": "pack_characters", "type": "function", "loc": [2834, 2836], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "vector": [2, 1, 0.6873, 0.0007, 1, 0.91, 0.3571, 434, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "pack_characters", "arg_names": ["self", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pack_characters(self, info):\n self.subpattern = self.subpattern.pack_characters(info)\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2835_C8", "label": "self.subpattern = pack_characters()", "type": "assigned_variable", "loc": [2835, 2835], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2834_C4", "vector": [14, 2, 0.6873, 0.0002, 2, 0.82, 0.0, 131, 3, 1, 0, 0, 434, 10, 1], "semantic": {"name": "self.subpattern", "arg_names": [], "import_names": [], "rhs_call_name": "pack_characters", "annotation": ""}, "snippet": " self.subpattern = self.subpattern.pack_characters(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2836_C8", "label": "return", "type": "return", "loc": [2836, 2836], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2834_C4", "vector": [13, 2, 0.6875, 0.0002, 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 self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2838_C4", "label": "remove_captures", "type": "function", "loc": [2838, 2839], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "vector": [2, 1, 0.6881, 0.0005, 1, 0.91, 0.4286, 732, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "remove_captures", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove_captures(self):\n return self.subpattern.remove_captures()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2839_C8", "label": "return", "type": "return", "loc": [2839, 2839], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2838_C4", "vector": [13, 2, 0.6882, 0.0002, 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 self.subpattern.remove_captures()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2841_C4", "label": "is_atomic", "type": "function", "loc": [2841, 2842], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "vector": [2, 1, 0.6888, 0.0005, 1, 0.91, 0.5, 841, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "is_atomic", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_atomic(self):\n return self.subpattern.is_atomic()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2842_C8", "label": "return", "type": "return", "loc": [2842, 2842], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2841_C4", "vector": [13, 2, 0.689, 0.0002, 2, 0.97, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.subpattern.is_atomic()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2844_C4", "label": "can_be_affix", "type": "function", "loc": [2844, 2845], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "vector": [2, 1, 0.6896, 0.0005, 1, 0.91, 0.5714, 276, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "can_be_affix", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def can_be_affix(self):\n return self.subpattern.can_be_affix()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2845_C8", "label": "return", "type": "return", "loc": [2845, 2845], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2844_C4", "vector": [13, 2, 0.6897, 0.0002, 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 self.subpattern.can_be_affix()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2847_C4", "label": "contains_group", "type": "function", "loc": [2847, 2848], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "vector": [2, 1, 0.6903, 0.0005, 1, 0.91, 0.6429, 206, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "contains_group", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def contains_group(self):\n return self.subpattern.contains_group()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2848_C8", "label": "return", "type": "return", "loc": [2848, 2848], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2847_C4", "vector": [13, 2, 0.6904, 0.0002, 2, 0.94, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.subpattern.contains_group()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2850_C4", "label": "_compile", "type": "function", "loc": [2850, 2852], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "vector": [2, 1, 0.6912, 0.0007, 1, 0.91, 0.7143, 779, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n return ([(OP.LOOKAROUND, int(self.positive), int(not self.behind))] +\n self.subpattern.compile(self.behind) + [(OP.END, )])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2851_C8", "label": "return", "type": "return", "loc": [2851, 2852], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2850_C4", "vector": [13, 2, 0.6913, 0.0005, 2, 0.51, 0.0, 0, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ([(OP.LOOKAROUND, int(self.positive), int(not self.behind))] +\n self.subpattern.compile(self.behind) + [(OP.END, )])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2854_C4", "label": "_dump", "type": "function", "loc": [2854, 2857], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "vector": [2, 1, 0.6922, 0.001, 1, 0.91, 0.7857, 656, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n print(\"{}LOOK{} {}\".format(INDENT * indent,\n self._dir_text[self.behind], POS_TEXT[self.positive]))\n self.subpattern.dump(indent + 1, self.behind)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2855_C8", "label": "print()", "type": "expression", "loc": [2855, 2856], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2854_C4", "vector": [8, 2, 0.6922, 0.0005, 2, 0.77, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}LOOK{} {}\".format(INDENT * indent,\n self._dir_text[self.behind], POS_TEXT[self.positive]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2857_C8", "label": "dump()", "type": "expression", "loc": [2857, 2857], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2854_C4", "vector": [8, 2, 0.6926, 0.0002, 2, 0.77, 1.0, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " self.subpattern.dump(indent + 1, self.behind)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2859_C4", "label": "is_empty", "type": "function", "loc": [2859, 2860], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "vector": [2, 1, 0.6932, 0.0005, 1, 0.91, 0.8571, 623, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "is_empty", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_empty(self):\n return self.subpattern.is_empty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2860_C8", "label": "return", "type": "return", "loc": [2860, 2860], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2859_C4", "vector": [13, 2, 0.6933, 0.0002, 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 self.subpattern.is_empty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2862_C4", "label": "__eq__", "type": "function", "loc": [2862, 2864], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "vector": [2, 1, 0.6941, 0.0007, 1, 0.91, 0.9286, 763, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n return type(self) is type(other) and (self.behind, self.positive,\n self.subpattern) == (other.behind, other.positive, other.subpattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2863_C8", "label": "return", "type": "return", "loc": [2863, 2864], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2862_C4", "vector": [13, 2, 0.6942, 0.0005, 2, 0.88, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return type(self) is type(other) and (self.behind, self.positive,\n self.subpattern) == (other.behind, other.positive, other.subpattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2866_C4", "label": "max_width", "type": "function", "loc": [2866, 2867], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "vector": [2, 1, 0.6949, 0.0005, 1, 0.91, 1.0, 0, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "max_width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_width(self):\n return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2867_C8", "label": "return", "type": "return", "loc": [2867, 2867], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2866_C4", "vector": [13, 2, 0.695, 0.0002, 2, 0.66, 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_1389:ClassDef_L2869_C0", "label": "PrecompiledCode", "type": "class", "loc": [2869, 2874], "level": 0, "parent": null, "vector": [3, 0, 0.6961, 0.0015, 0, 0.66, 0.8446, 223, 0, 2, 0, 0, 852, 0, 1], "semantic": {"name": "PrecompiledCode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PrecompiledCode(RegexBase):\n def __init__(self, code):\n self.code = code\n\n def _compile(self, reverse, fuzzy):\n return [tuple(self.code)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2870_C4", "label": "__init__", "type": "function", "loc": [2870, 2871], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2869_C0", "vector": [2, 1, 0.6959, 0.0005, 1, 0.99, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "code"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, code):\n self.code = code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2871_C8", "label": "self.code =", "type": "assigned_variable", "loc": [2871, 2871], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2870_C4", "vector": [14, 2, 0.696, 0.0002, 2, 0.74, 0.0, 296, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.code = code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2873_C4", "label": "_compile", "type": "function", "loc": [2873, 2874], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2869_C0", "vector": [2, 1, 0.6966, 0.0005, 1, 0.99, 1.0, 779, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n return [tuple(self.code)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2874_C8", "label": "return", "type": "return", "loc": [2874, 2874], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2873_C4", "vector": [13, 2, 0.6967, 0.0002, 2, 0.57, 0.0, 0, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [tuple(self.code)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "label": "Property", "type": "class", "loc": [2876, 2926], "level": 0, "parent": null, "vector": [3, 0, 0.7033, 0.0124, 0, 0.66, 0.8497, 831, 0, 9, 0, 0, 852, 0, 8], "semantic": {"name": "Property", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Property(RegexBase):\n _opcode = {(NOCASE, False): OP.PROPERTY, (IGNORECASE, False):\n OP.PROPERTY_IGN, (FULLCASE, False): OP.PROPERTY, (FULLIGNORECASE, False):\n OP.PROPERTY_IGN, (NOCASE, True): OP.PROPERTY_REV, (IGNORECASE, True):\n OP.PROPERTY_IGN_REV, (FULLCASE, True): OP.PROPERTY_REV, (FULLIGNORECASE,\n True): OP.PROPERTY_IGN_REV}\n\n def __init__(self, value, positive=True, case_flags=NOCASE,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2877_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [2877, 2881], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "vector": [14, 1, 0.6979, 0.0012, 1, 0.95, 0.0, 52, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = {(NOCASE, False): OP.PROPERTY, (IGNORECASE, False):\n OP.PROPERTY_IGN, (FULLCASE, False): OP.PROPERTY, (FULLIGNORECASE, False):\n OP.PROPERTY_IGN, (NOCASE, True): OP.PROPERTY_REV, (IGNORECASE, True):\n OP.PROPERTY_IGN_REV, (FULLCASE, True): OP.PROPERTY_REV, (FULLIGNORECASE,\n True): OP.PROPERTY_IGN_REV}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2883_C4", "label": "__init__", "type": "function", "loc": [2883, 2892], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "vector": [2, 1, 0.7, 0.0024, 1, 0.95, 0.1111, 555, 0, 5, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "value", "positive", "case_flags", "zerowidth"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, value, positive=True, case_flags=NOCASE,\n zerowidth=False):\n RegexBase.__init__(self)\n self.value = value\n self.positive = bool(positive)\n self.case_flags = case_flags\n self.zerowidth = bool(zerowidth)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2885_C8", "label": "__init__()", "type": "expression", "loc": [2885, 2885], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2883_C4", "vector": [8, 2, 0.6994, 0.0002, 2, 0.82, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " RegexBase.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2886_C8", "label": "self.value =", "type": "assigned_variable", "loc": [2886, 2886], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2883_C4", "vector": [14, 2, 0.6996, 0.0002, 2, 0.82, 0.2, 966, 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_1389:Assign_L2887_C8", "label": "self.positive = bool()", "type": "assigned_variable", "loc": [2887, 2887], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2883_C4", "vector": [14, 2, 0.6999, 0.0002, 2, 0.82, 0.4, 226, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "self.positive", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " self.positive = bool(positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2888_C8", "label": "self.case_flags =", "type": "assigned_variable", "loc": [2888, 2888], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2883_C4", "vector": [14, 2, 0.7001, 0.0002, 2, 0.82, 0.6, 56, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.case_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.case_flags = case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2889_C8", "label": "self.zerowidth = bool()", "type": "assigned_variable", "loc": [2889, 2889], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2883_C4", "vector": [14, 2, 0.7004, 0.0002, 2, 0.82, 0.8, 68, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "self.zerowidth", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " self.zerowidth = bool(zerowidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2891_C8", "label": "self._key =", "type": "assigned_variable", "loc": [2891, 2892], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2883_C4", "vector": [14, 2, 0.701, 0.0005, 2, 0.82, 1.0, 449, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "self._key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._key = (self.__class__, self.value, self.positive,\n self.case_flags, self.zerowidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2894_C4", "label": "rebuild", "type": "function", "loc": [2894, 2895], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "vector": [2, 1, 0.7017, 0.0005, 1, 0.95, 0.2222, 486, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "rebuild", "arg_names": ["self", "positive", "case_flags", "zerowidth"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def rebuild(self, positive, case_flags, zerowidth):\n return Property(self.value, positive, case_flags, zerowidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2895_C8", "label": "return", "type": "return", "loc": [2895, 2895], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2894_C4", "vector": [13, 2, 0.7018, 0.0002, 2, 0.64, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Property(self.value, positive, case_flags, zerowidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2897_C4", "label": "optimise", "type": "function", "loc": [2897, 2898], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "vector": [2, 1, 0.7024, 0.0005, 1, 0.95, 0.3333, 265, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "optimise", "arg_names": ["self", "info", "in_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def optimise(self, info, in_set=False):\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2898_C8", "label": "return", "type": "return", "loc": [2898, 2898], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2897_C4", "vector": [13, 2, 0.7025, 0.0002, 2, 0.54, 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_1389:FunctionDef_L2900_C4", "label": "get_firstset", "type": "function", "loc": [2900, 2901], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "vector": [2, 1, 0.7032, 0.0005, 1, 0.95, 0.4444, 638, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_firstset", "arg_names": ["self", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_firstset(self, reverse):\n return set([self])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2901_C8", "label": "return", "type": "return", "loc": [2901, 2901], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2900_C4", "vector": [13, 2, 0.7033, 0.0002, 2, 0.32, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return set([self])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2903_C4", "label": "has_simple_start", "type": "function", "loc": [2903, 2904], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "vector": [2, 1, 0.7039, 0.0005, 1, 0.95, 0.5556, 317, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "has_simple_start", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def has_simple_start(self):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2904_C8", "label": "return", "type": "return", "loc": [2904, 2904], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2903_C4", "vector": [13, 2, 0.704, 0.0002, 2, 0.89, 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_1389:FunctionDef_L2906_C4", "label": "_compile", "type": "function", "loc": [2906, 2914], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "vector": [2, 1, 0.7055, 0.0022, 1, 0.95, 0.6667, 779, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n flags = 0\n if self.positive:\n flags |= POSITIVE_OP\n if self.zerowidth:\n flags |= ZEROWIDTH_OP\n if fuzzy:\n flags |= FUZZY_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2907_C8", "label": "flags =", "type": "assigned_variable", "loc": [2907, 2907], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2906_C4", "vector": [14, 2, 0.7047, 0.0002, 2, 0.54, 0.0, 375, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " flags = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2908_C8", "label": "if", "type": "if", "loc": [2908, 2909], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2906_C4", "vector": [4, 2, 0.7051, 0.0005, 2, 0.54, 0.25, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.positive:\n flags |= POSITIVE_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2910_C8", "label": "if", "type": "if", "loc": [2910, 2911], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2906_C4", "vector": [4, 2, 0.7056, 0.0005, 2, 0.54, 0.5, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.zerowidth:\n flags |= ZEROWIDTH_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2912_C8", "label": "if", "type": "if", "loc": [2912, 2913], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2906_C4", "vector": [4, 2, 0.7061, 0.0005, 2, 0.54, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if fuzzy:\n flags |= FUZZY_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2914_C8", "label": "return", "type": "return", "loc": [2914, 2914], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2906_C4", "vector": [13, 2, 0.7064, 0.0002, 2, 0.54, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [(self._opcode[self.case_flags, reverse], flags, self.value)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2916_C4", "label": "_dump", "type": "function", "loc": [2916, 2920], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "vector": [2, 1, 0.7074, 0.0012, 1, 0.95, 0.7778, 656, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n prop = PROPERTY_NAMES[self.value >> 16]\n name, value = prop[0], prop[1][self.value & 0xFFFF]\n print(\"{}PROPERTY {} {}:{}{}\".format(INDENT * indent,\n POS_TEXT[self.positive], name, value, CASE_TEXT[self.case_flags]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2917_C8", "label": "prop =", "type": "assigned_variable", "loc": [2917, 2917], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2916_C4", "vector": [14, 2, 0.7072, 0.0002, 2, 0.92, 0.0, 17, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prop", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prop = PROPERTY_NAMES[self.value >> 16]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2918_C8", "label": "name, value =", "type": "assigned_variable", "loc": [2918, 2918], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2916_C4", "vector": [14, 2, 0.7074, 0.0002, 2, 0.92, 0.5, 509, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "name, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name, value = prop[0], prop[1][self.value & 0xFFFF]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2919_C8", "label": "print()", "type": "expression", "loc": [2919, 2920], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2916_C4", "vector": [8, 2, 0.7078, 0.0005, 2, 0.92, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}PROPERTY {} {}:{}{}\".format(INDENT * indent,\n POS_TEXT[self.positive], name, value, CASE_TEXT[self.case_flags]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2922_C4", "label": "matches", "type": "function", "loc": [2922, 2923], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "vector": [2, 1, 0.7085, 0.0005, 1, 0.95, 0.8889, 684, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "matches", "arg_names": ["self", "ch"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def matches(self, ch):\n return _regex.has_property_value(self.value, ch) == self.positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2923_C8", "label": "return", "type": "return", "loc": [2923, 2923], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2922_C4", "vector": [13, 2, 0.7086, 0.0002, 2, 0.06, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _regex.has_property_value(self.value, ch) == self.positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2925_C4", "label": "max_width", "type": "function", "loc": [2925, 2926], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "vector": [2, 1, 0.7092, 0.0005, 1, 0.95, 1.0, 0, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "max_width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_width(self):\n return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2926_C8", "label": "return", "type": "return", "loc": [2926, 2926], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2925_C4", "vector": [13, 2, 0.7093, 0.0002, 2, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2928_C0", "label": "Range", "type": "class", "loc": [2928, 3003], "level": 0, "parent": null, "vector": [3, 0, 0.7189, 0.0184, 0, 0.66, 0.8549, 738, 0, 7, 0, 0, 852, 0, 21], "semantic": {"name": "Range", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Range(RegexBase):\n _opcode = {(NOCASE, False): OP.RANGE, (IGNORECASE, False): OP.RANGE_IGN,\n (FULLCASE, False): OP.RANGE, (FULLIGNORECASE, False): OP.RANGE_IGN,\n (NOCASE, True): OP.RANGE_REV, (IGNORECASE, True): OP.RANGE_IGN_REV,\n (FULLCASE, True): OP.RANGE_REV, (FULLIGNORECASE, True): OP.RANGE_IGN_REV}\n _op_name = \"RANGE\"\n\n def __init__(self, lower, upper, positive=True, case_flags=NOCASE,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2929_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [2929, 2932], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2928_C0", "vector": [14, 1, 0.7104, 0.001, 1, 0.38, 0.0, 52, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = {(NOCASE, False): OP.RANGE, (IGNORECASE, False): OP.RANGE_IGN,\n (FULLCASE, False): OP.RANGE, (FULLIGNORECASE, False): OP.RANGE_IGN,\n (NOCASE, True): OP.RANGE_REV, (IGNORECASE, True): OP.RANGE_IGN_REV,\n (FULLCASE, True): OP.RANGE_REV, (FULLIGNORECASE, True): OP.RANGE_IGN_REV}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2933_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [2933, 2933], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2928_C0", "vector": [14, 1, 0.711, 0.0002, 1, 0.38, 0.125, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"RANGE\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2935_C4", "label": "__init__", "type": "function", "loc": [2935, 2945], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2928_C0", "vector": [2, 1, 0.7127, 0.0027, 1, 0.38, 0.25, 555, 0, 6, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "lower", "upper", "positive", "case_flags", "zerowidth"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, lower, upper, positive=True, case_flags=NOCASE,\n zerowidth=False):\n RegexBase.__init__(self)\n self.lower = lower\n self.upper = upper\n self.positive = bool(positive)\n self.case_flags = case_flags\n self.zerowidth = bool(zerowidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2937_C8", "label": "__init__()", "type": "expression", "loc": [2937, 2937], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2935_C4", "vector": [8, 2, 0.712, 0.0002, 2, 0.21, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " RegexBase.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2938_C8", "label": "self.lower =", "type": "assigned_variable", "loc": [2938, 2938], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2935_C4", "vector": [14, 2, 0.7122, 0.0002, 2, 0.21, 0.1667, 722, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.lower", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.lower = lower"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2939_C8", "label": "self.upper =", "type": "assigned_variable", "loc": [2939, 2939], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2935_C4", "vector": [14, 2, 0.7125, 0.0002, 2, 0.21, 0.3333, 366, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.upper", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.upper = upper"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2940_C8", "label": "self.positive = bool()", "type": "assigned_variable", "loc": [2940, 2940], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2935_C4", "vector": [14, 2, 0.7127, 0.0002, 2, 0.21, 0.5, 226, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "self.positive", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " self.positive = bool(positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2941_C8", "label": "self.case_flags =", "type": "assigned_variable", "loc": [2941, 2941], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2935_C4", "vector": [14, 2, 0.713, 0.0002, 2, 0.21, 0.6667, 56, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.case_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.case_flags = case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2942_C8", "label": "self.zerowidth = bool()", "type": "assigned_variable", "loc": [2942, 2942], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2935_C4", "vector": [14, 2, 0.7132, 0.0002, 2, 0.21, 0.8333, 68, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "self.zerowidth", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " self.zerowidth = bool(zerowidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2944_C8", "label": "self._key =", "type": "assigned_variable", "loc": [2944, 2945], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2935_C4", "vector": [14, 2, 0.7138, 0.0005, 2, 0.21, 1.0, 449, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "self._key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._key = (self.__class__, self.lower, self.upper, self.positive,\n self.case_flags, self.zerowidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2947_C4", "label": "rebuild", "type": "function", "loc": [2947, 2948], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2928_C0", "vector": [2, 1, 0.7145, 0.0005, 1, 0.38, 0.375, 486, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "rebuild", "arg_names": ["self", "positive", "case_flags", "zerowidth"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def rebuild(self, positive, case_flags, zerowidth):\n return Range(self.lower, self.upper, positive, case_flags, zerowidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2948_C8", "label": "return", "type": "return", "loc": [2948, 2948], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2947_C4", "vector": [13, 2, 0.7147, 0.0002, 2, 0.7, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Range(self.lower, self.upper, positive, case_flags, zerowidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2950_C4", "label": "optimise", "type": "function", "loc": [2950, 2979], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2928_C0", "vector": [2, 1, 0.7187, 0.0073, 1, 0.38, 0.5, 265, 0, 3, 1, 0, 0, 0, 9], "semantic": {"name": "optimise", "arg_names": ["self", "info", "in_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def optimise(self, info, in_set=False):\n # Is the range case-sensitive?\n if not self.positive or not (self.case_flags & IGNORECASE) or in_set:\n return self\n\n # Is full case-folding possible?\n if (not (info.flags & UNICODE) or (self.case_flags & FULLIGNORECASE) !=\n FULLIGNORECASE):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2952_C8", "label": "if", "type": "if", "loc": [2952, 2953], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2950_C4", "vector": [4, 2, 0.7158, 0.0005, 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 self.positive or not (self.case_flags & IGNORECASE) or in_set:\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2953_C12", "label": "return", "type": "return", "loc": [2953, 2953], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2952_C8", "vector": [13, 3, 0.7159, 0.0002, 3, 0.17, 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_1389:If_L2956_C8", "label": "if", "type": "if", "loc": [2956, 2958], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2950_C4", "vector": [4, 2, 0.7168, 0.0007, 2, 0.02, 0.1429, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not (info.flags & UNICODE) or (self.case_flags & FULLIGNORECASE) !=\n FULLIGNORECASE):\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2958_C12", "label": "return", "type": "return", "loc": [2958, 2958], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2956_C8", "vector": [13, 3, 0.7171, 0.0002, 3, 0.27, 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_1389:Assign_L2961_C8", "label": "expanding_chars = get_expand_on_folding()", "type": "assigned_variable", "loc": [2961, 2961], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2950_C4", "vector": [14, 2, 0.7178, 0.0002, 2, 0.02, 0.2857, 347, 3, 0, 0, 0, 869, 10, 1], "semantic": {"name": "expanding_chars", "arg_names": [], "import_names": [], "rhs_call_name": "get_expand_on_folding", "annotation": ""}, "snippet": " expanding_chars = _regex.get_expand_on_folding()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2964_C8", "label": "items =", "type": "assigned_variable", "loc": [2964, 2964], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2950_C4", "vector": [14, 2, 0.7185, 0.0002, 2, 0.02, 0.4286, 339, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2965_C8", "label": "for ch", "type": "for", "loc": [2965, 2969], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2950_C4", "vector": [6, 2, 0.7193, 0.0012, 2, 0.02, 0.5714, 263, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ch in expanding_chars:\n if self.lower <= ord(ch) <= self.upper:\n folded = _regex.fold_case(FULL_CASE_FOLDING, ch)\n items.append(String([ord(c) for c in folded],\n case_flags=self.case_flags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2966_C12", "label": "if", "type": "if", "loc": [2966, 2969], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2965_C8", "vector": [4, 3, 0.7194, 0.001, 3, 0.67, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.lower <= ord(ch) <= self.upper:\n folded = _regex.fold_case(FULL_CASE_FOLDING, ch)\n items.append(String([ord(c) for c in folded],\n case_flags=self.case_flags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2967_C16", "label": "folded = fold_case()", "type": "assigned_variable", "loc": [2967, 2967], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2966_C12", "vector": [14, 4, 0.7193, 0.0002, 4, 0.35, 0.0, 68, 3, 2, 0, 0, 184, 10, 1], "semantic": {"name": "folded", "arg_names": [], "import_names": [], "rhs_call_name": "fold_case", "annotation": ""}, "snippet": " folded = _regex.fold_case(FULL_CASE_FOLDING, ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2968_C16", "label": "append()", "type": "expression", "loc": [2968, 2969], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2966_C12", "vector": [8, 4, 0.7196, 0.0005, 4, 0.35, 1.0, 243, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " items.append(String([ord(c) for c in folded],\n case_flags=self.case_flags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2971_C8", "label": "if", "type": "if", "loc": [2971, 2973], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2950_C4", "vector": [4, 2, 0.7205, 0.0007, 2, 0.02, 0.7143, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not items:\n # We can fall back to simple case-folding.\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2973_C12", "label": "return", "type": "return", "loc": [2973, 2973], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2971_C8", "vector": [13, 3, 0.7207, 0.0002, 3, 0.02, 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_1389:If_L2975_C8", "label": "if", "type": "if", "loc": [2975, 2977], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2950_C4", "vector": [4, 2, 0.7215, 0.0007, 2, 0.02, 0.8571, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(items) < self.upper - self.lower + 1:\n # Not all the characters are covered by the full case-folding.\n items.insert(0, self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2977_C12", "label": "insert()", "type": "expression", "loc": [2977, 2977], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2975_C8", "vector": [8, 3, 0.7217, 0.0002, 3, 0.44, 0.0, 368, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " items.insert(0, self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2979_C8", "label": "return", "type": "return", "loc": [2979, 2979], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2950_C4", "vector": [13, 2, 0.7222, 0.0002, 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 Branch(items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2981_C4", "label": "_compile", "type": "function", "loc": [2981, 2990], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2928_C0", "vector": [2, 1, 0.7238, 0.0024, 1, 0.38, 0.625, 779, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n flags = 0\n if self.positive:\n flags |= POSITIVE_OP\n if self.zerowidth:\n flags |= ZEROWIDTH_OP\n if fuzzy:\n flags |= FUZZY_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2982_C8", "label": "flags =", "type": "assigned_variable", "loc": [2982, 2982], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2981_C4", "vector": [14, 2, 0.7229, 0.0002, 2, 0.68, 0.0, 375, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " flags = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2983_C8", "label": "if", "type": "if", "loc": [2983, 2984], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2981_C4", "vector": [4, 2, 0.7233, 0.0005, 2, 0.68, 0.25, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.positive:\n flags |= POSITIVE_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2985_C8", "label": "if", "type": "if", "loc": [2985, 2986], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2981_C4", "vector": [4, 2, 0.7238, 0.0005, 2, 0.68, 0.5, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.zerowidth:\n flags |= ZEROWIDTH_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2987_C8", "label": "if", "type": "if", "loc": [2987, 2988], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2981_C4", "vector": [4, 2, 0.7242, 0.0005, 2, 0.68, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if fuzzy:\n flags |= FUZZY_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2989_C8", "label": "return", "type": "return", "loc": [2989, 2990], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2981_C4", "vector": [13, 2, 0.7247, 0.0005, 2, 0.68, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [(self._opcode[self.case_flags, reverse], flags, self.lower,\n self.upper)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2992_C4", "label": "_dump", "type": "function", "loc": [2992, 2997], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2928_C0", "vector": [2, 1, 0.7259, 0.0015, 1, 0.38, 0.75, 656, 0, 3, 0, 0, 0, 0, 8], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n display_lower = ascii(chr(self.lower)).lstrip(\"bu\")\n display_upper = ascii(chr(self.upper)).lstrip(\"bu\")\n print(\"{}RANGE {} {} {}{}\".format(INDENT * indent,\n POS_TEXT[self.positive], display_lower, display_upper,\n CASE_TEXT[self.case_flags]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2993_C8", "label": "display_lower = lstrip()", "type": "assigned_variable", "loc": [2993, 2993], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2992_C4", "vector": [14, 2, 0.7256, 0.0002, 2, 0.77, 0.0, 961, 3, 1, 0, 0, 313, 10, 3], "semantic": {"name": "display_lower", "arg_names": [], "import_names": [], "rhs_call_name": "lstrip", "annotation": ""}, "snippet": " display_lower = ascii(chr(self.lower)).lstrip(\"bu\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2994_C8", "label": "display_upper = lstrip()", "type": "assigned_variable", "loc": [2994, 2994], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2992_C4", "vector": [14, 2, 0.7258, 0.0002, 2, 0.77, 0.5, 476, 3, 1, 0, 0, 313, 10, 3], "semantic": {"name": "display_upper", "arg_names": [], "import_names": [], "rhs_call_name": "lstrip", "annotation": ""}, "snippet": " display_upper = ascii(chr(self.upper)).lstrip(\"bu\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2995_C8", "label": "print()", "type": "expression", "loc": [2995, 2997], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2992_C4", "vector": [8, 2, 0.7263, 0.0007, 2, 0.77, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}RANGE {} {} {}{}\".format(INDENT * indent,\n POS_TEXT[self.positive], display_lower, display_upper,\n CASE_TEXT[self.case_flags]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2999_C4", "label": "matches", "type": "function", "loc": [2999, 3000], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2928_C0", "vector": [2, 1, 0.7272, 0.0005, 1, 0.38, 0.875, 684, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "matches", "arg_names": ["self", "ch"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def matches(self, ch):\n return (self.lower <= ch <= self.upper) == self.positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3000_C8", "label": "return", "type": "return", "loc": [3000, 3000], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2999_C4", "vector": [13, 2, 0.7273, 0.0002, 2, 0.73, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (self.lower <= ch <= self.upper) == self.positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3002_C4", "label": "max_width", "type": "function", "loc": [3002, 3003], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2928_C0", "vector": [2, 1, 0.7279, 0.0005, 1, 0.38, 1.0, 0, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "max_width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_width(self):\n return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3003_C8", "label": "return", "type": "return", "loc": [3003, 3003], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3002_C4", "vector": [13, 2, 0.728, 0.0002, 2, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3005_C0", "label": "RefGroup", "type": "class", "loc": [3005, 3049], "level": 0, "parent": null, "vector": [3, 0, 0.7338, 0.0109, 0, 0.66, 0.8601, 6, 0, 6, 0, 0, 852, 0, 7], "semantic": {"name": "RefGroup", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RefGroup(RegexBase):\n _opcode = {(NOCASE, False): OP.REF_GROUP, (IGNORECASE, False):\n OP.REF_GROUP_IGN, (FULLCASE, False): OP.REF_GROUP, (FULLIGNORECASE,\n False): OP.REF_GROUP_FLD, (NOCASE, True): OP.REF_GROUP_REV, (IGNORECASE,\n True): OP.REF_GROUP_IGN_REV, (FULLCASE, True): OP.REF_GROUP_REV,\n (FULLIGNORECASE, True): OP.REF_GROUP_FLD_REV}\n\n def __init__(self, info, group, position, case_flags=NOCASE):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3006_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [3006, 3010], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3005_C0", "vector": [14, 1, 0.7292, 0.0012, 1, 0.31, 0.0, 52, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = {(NOCASE, False): OP.REF_GROUP, (IGNORECASE, False):\n OP.REF_GROUP_IGN, (FULLCASE, False): OP.REF_GROUP, (FULLIGNORECASE,\n False): OP.REF_GROUP_FLD, (NOCASE, True): OP.REF_GROUP_REV, (IGNORECASE,\n True): OP.REF_GROUP_IGN_REV, (FULLCASE, True): OP.REF_GROUP_REV,\n (FULLIGNORECASE, True): OP.REF_GROUP_FLD_REV}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3012_C4", "label": "__init__", "type": "function", "loc": [3012, 3019], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3005_C0", "vector": [2, 1, 0.731, 0.0019, 1, 0.31, 0.1667, 555, 0, 5, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "info", "group", "position", "case_flags"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, info, group, position, case_flags=NOCASE):\n RegexBase.__init__(self)\n self.info = info\n self.group = group\n self.position = position\n self.case_flags = case_flags\n\n self._key = self.__class__, self.group, self.case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3013_C8", "label": "__init__()", "type": "expression", "loc": [3013, 3013], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3012_C4", "vector": [8, 2, 0.7304, 0.0002, 2, 0.66, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " RegexBase.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3014_C8", "label": "self.info =", "type": "assigned_variable", "loc": [3014, 3014], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3012_C4", "vector": [14, 2, 0.7307, 0.0002, 2, 0.66, 0.2, 264, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.info = info"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3015_C8", "label": "self.group =", "type": "assigned_variable", "loc": [3015, 3015], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3012_C4", "vector": [14, 2, 0.7309, 0.0002, 2, 0.66, 0.4, 561, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.group = group"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3016_C8", "label": "self.position =", "type": "assigned_variable", "loc": [3016, 3016], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3012_C4", "vector": [14, 2, 0.7312, 0.0002, 2, 0.66, 0.6, 95, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.position", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.position = position"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3017_C8", "label": "self.case_flags =", "type": "assigned_variable", "loc": [3017, 3017], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3012_C4", "vector": [14, 2, 0.7314, 0.0002, 2, 0.66, 0.8, 56, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.case_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.case_flags = case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3019_C8", "label": "self._key =", "type": "assigned_variable", "loc": [3019, 3019], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3012_C4", "vector": [14, 2, 0.7319, 0.0002, 2, 0.66, 1.0, 449, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "self._key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._key = self.__class__, self.group, self.case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3021_C4", "label": "fix_groups", "type": "function", "loc": [3021, 3033], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3005_C0", "vector": [2, 1, 0.7338, 0.0032, 1, 0.31, 0.3333, 269, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "fix_groups", "arg_names": ["self", "pattern", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fix_groups(self, pattern, reverse, fuzzy):\n try:\n self.group = int(self.group)\n except ValueError:\n try:\n self.group = self.info.group_index[self.group]\n except KeyError:\n raise error(\"unknown group\", pattern, self.position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3022_C8", "label": "try", "type": "try", "loc": [3022, 3028], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3021_C4", "vector": [7, 2, 0.7333, 0.0017, 2, 0.67, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.group = int(self.group)\n except ValueError:\n try:\n self.group = self.info.group_index[self.group]\n except KeyError:\n raise error(\"unknown group\", pattern, self.position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3023_C12", "label": "self.group = int()", "type": "assigned_variable", "loc": [3023, 3023], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3022_C8", "vector": [14, 3, 0.7328, 0.0002, 3, 0.05, 0.0, 561, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "self.group", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " self.group = int(self.group)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3025_C12", "label": "try", "type": "try", "loc": [3025, 3028], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3022_C8", "vector": [7, 3, 0.7337, 0.001, 3, 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 self.group = self.info.group_index[self.group]\n except KeyError:\n raise error(\"unknown group\", pattern, self.position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3026_C16", "label": "self.group =", "type": "assigned_variable", "loc": [3026, 3026], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3025_C12", "vector": [14, 4, 0.7336, 0.0002, 4, 0.21, 0.0, 561, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.group = self.info.group_index[self.group]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3030_C8", "label": "if", "type": "if", "loc": [3030, 3031], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3021_C4", "vector": [4, 2, 0.7347, 0.0005, 2, 0.67, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not 1 <= self.group <= self.info.group_count:\n raise error(\"unknown group\", pattern, self.position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3033_C8", "label": "self._key =", "type": "assigned_variable", "loc": [3033, 3033], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3021_C4", "vector": [14, 2, 0.7353, 0.0002, 2, 0.67, 1.0, 449, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "self._key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._key = self.__class__, self.group, self.case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3035_C4", "label": "remove_captures", "type": "function", "loc": [3035, 3036], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3005_C0", "vector": [2, 1, 0.7359, 0.0005, 1, 0.31, 0.5, 732, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove_captures", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove_captures(self):\n raise error(\"group reference not allowed\", pattern, self.position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3038_C4", "label": "_compile", "type": "function", "loc": [3038, 3042], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3005_C0", "vector": [2, 1, 0.737, 0.0012, 1, 0.31, 0.6667, 779, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n flags = 0\n if fuzzy:\n flags |= FUZZY_OP\n return [(self._opcode[self.case_flags, reverse], flags, self.group)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3039_C8", "label": "flags =", "type": "assigned_variable", "loc": [3039, 3039], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3038_C4", "vector": [14, 2, 0.7367, 0.0002, 2, 0.67, 0.0, 375, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " flags = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3040_C8", "label": "if", "type": "if", "loc": [3040, 3041], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3038_C4", "vector": [4, 2, 0.7371, 0.0005, 2, 0.67, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if fuzzy:\n flags |= FUZZY_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3042_C8", "label": "return", "type": "return", "loc": [3042, 3042], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3038_C4", "vector": [13, 2, 0.7375, 0.0002, 2, 0.67, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [(self._opcode[self.case_flags, reverse], flags, self.group)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3044_C4", "label": "_dump", "type": "function", "loc": [3044, 3046], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3005_C0", "vector": [2, 1, 0.7382, 0.0007, 1, 0.31, 0.8333, 656, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n print(\"{}REF_GROUP {}{}\".format(INDENT * indent, self.group,\n CASE_TEXT[self.case_flags]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3045_C8", "label": "print()", "type": "expression", "loc": [3045, 3046], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3044_C4", "vector": [8, 2, 0.7383, 0.0005, 2, 0.15, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}REF_GROUP {}{}\".format(INDENT * indent, self.group,\n CASE_TEXT[self.case_flags]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3048_C4", "label": "max_width", "type": "function", "loc": [3048, 3049], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3005_C0", "vector": [2, 1, 0.739, 0.0005, 1, 0.31, 1.0, 0, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "max_width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_width(self):\n return UNLIMITED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3049_C8", "label": "return", "type": "return", "loc": [3049, 3049], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3048_C4", "vector": [13, 2, 0.7392, 0.0002, 2, 0.47, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return UNLIMITED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3051_C0", "label": "SearchAnchor", "type": "class", "loc": [3051, 3053], "level": 0, "parent": null, "vector": [3, 0, 0.7399, 0.0007, 0, 0.66, 0.8653, 160, 0, 0, 0, 0, 752, 0, 0], "semantic": {"name": "SearchAnchor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SearchAnchor(ZeroWidthBase):\n _opcode = OP.SEARCH_ANCHOR\n _op_name = \"SEARCH_ANCHOR\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3052_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [3052, 3052], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3051_C0", "vector": [14, 1, 0.7399, 0.0002, 1, 0.19, 0.0, 52, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = OP.SEARCH_ANCHOR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3053_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [3053, 3053], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3051_C0", "vector": [14, 1, 0.7401, 0.0002, 1, 0.19, 1.0, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"SEARCH_ANCHOR\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "label": "Sequence", "type": "class", "loc": [3055, 3200], "level": 0, "parent": null, "vector": [3, 0, 0.7582, 0.0354, 0, 0.66, 0.8705, 853, 0, 17, 0, 0, 852, 0, 50], "semantic": {"name": "Sequence", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Sequence(RegexBase):\n def __init__(self, items=None):\n RegexBase.__init__(self)\n if items is None:\n items = []\n\n self.items = items\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3056_C4", "label": "__init__", "type": "function", "loc": [3056, 3061], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "vector": [2, 1, 0.7415, 0.0015, 1, 0.24, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "items"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, items=None):\n RegexBase.__init__(self)\n if items is None:\n items = []\n\n self.items = items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3057_C8", "label": "__init__()", "type": "expression", "loc": [3057, 3057], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3056_C4", "vector": [8, 2, 0.7411, 0.0002, 2, 0.51, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " RegexBase.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3058_C8", "label": "if", "type": "if", "loc": [3058, 3059], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3056_C4", "vector": [4, 2, 0.7415, 0.0005, 2, 0.51, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if items is None:\n items = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3059_C12", "label": "items =", "type": "assigned_variable", "loc": [3059, 3059], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3058_C8", "vector": [14, 3, 0.7416, 0.0002, 3, 0.44, 0.0, 339, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3061_C8", "label": "self.items =", "type": "assigned_variable", "loc": [3061, 3061], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3056_C4", "vector": [14, 2, 0.7421, 0.0002, 2, 0.51, 1.0, 11, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.items = items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3063_C4", "label": "fix_groups", "type": "function", "loc": [3063, 3065], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "vector": [2, 1, 0.7428, 0.0007, 1, 0.24, 0.0625, 269, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "fix_groups", "arg_names": ["self", "pattern", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fix_groups(self, pattern, reverse, fuzzy):\n for s in self.items:\n s.fix_groups(pattern, reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3064_C8", "label": "for s", "type": "for", "loc": [3064, 3065], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3063_C4", "vector": [6, 2, 0.7429, 0.0005, 2, 0.97, 0.0, 553, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for s in self.items:\n s.fix_groups(pattern, reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3065_C12", "label": "fix_groups()", "type": "expression", "loc": [3065, 3065], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3064_C8", "vector": [8, 3, 0.743, 0.0002, 3, 0.81, 0.0, 269, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "fix_groups", "arg_names": [], "import_names": [], "rhs_call_name": "fix_groups", "annotation": ""}, "snippet": " s.fix_groups(pattern, reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3067_C4", "label": "optimise", "type": "function", "loc": [3067, 3077], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "vector": [2, 1, 0.7447, 0.0027, 1, 0.24, 0.125, 265, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "optimise", "arg_names": ["self", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def optimise(self, info):\n # Flatten the sequences.\n items = []\n for s in self.items:\n s = s.optimise(info)\n if isinstance(s, Sequence):\n items.extend(s.items)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3069_C8", "label": "items =", "type": "assigned_variable", "loc": [3069, 3069], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3067_C4", "vector": [14, 2, 0.744, 0.0002, 2, 0.38, 0.0, 339, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3070_C8", "label": "for s", "type": "for", "loc": [3070, 3075], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3067_C4", "vector": [6, 2, 0.7448, 0.0015, 2, 0.38, 0.5, 553, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for s in self.items:\n s = s.optimise(info)\n if isinstance(s, Sequence):\n items.extend(s.items)\n else:\n items.append(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3071_C12", "label": "s = optimise()", "type": "assigned_variable", "loc": [3071, 3071], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3070_C8", "vector": [14, 3, 0.7445, 0.0002, 3, 0.18, 0.0, 553, 3, 1, 0, 0, 265, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "optimise", "annotation": ""}, "snippet": " s = s.optimise(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3072_C12", "label": "if", "type": "if", "loc": [3072, 3075], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3070_C8", "vector": [4, 3, 0.7451, 0.001, 3, 0.18, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(s, Sequence):\n items.extend(s.items)\n else:\n items.append(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3073_C16", "label": "extend()", "type": "expression", "loc": [3073, 3073], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3072_C12", "vector": [8, 4, 0.745, 0.0002, 4, 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": " items.extend(s.items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3075_C16", "label": "append()", "type": "expression", "loc": [3075, 3075], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3072_C12", "vector": [8, 4, 0.7455, 0.0002, 4, 0.72, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " items.append(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3077_C8", "label": "return", "type": "return", "loc": [3077, 3077], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3067_C4", "vector": [13, 2, 0.7459, 0.0002, 2, 0.38, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return make_sequence(items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3079_C4", "label": "pack_characters", "type": "function", "loc": [3079, 3115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "vector": [2, 1, 0.7508, 0.009, 1, 0.24, 0.1875, 434, 0, 2, 1, 0, 0, 0, 15], "semantic": {"name": "pack_characters", "arg_names": ["self", "info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pack_characters(self, info):\n \"Packs sequences of characters into strings.\"\n items = []\n characters = []\n case_flags = NOCASE\n for s in self.items:\n if type(s) is Character and s.positive:\n if s.case_flags != case_flags:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3080_C8", "label": "expression", "type": "expression", "loc": [3080, 3080], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3079_C4", "vector": [8, 2, 0.7467, 0.0002, 2, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Packs sequences of characters into strings.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3081_C8", "label": "items =", "type": "assigned_variable", "loc": [3081, 3081], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3079_C4", "vector": [14, 2, 0.7469, 0.0002, 2, 0.43, 0.1667, 339, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3082_C8", "label": "characters =", "type": "assigned_variable", "loc": [3082, 3082], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3079_C4", "vector": [14, 2, 0.7472, 0.0002, 2, 0.43, 0.3333, 731, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "characters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " characters = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3083_C8", "label": "case_flags =", "type": "assigned_variable", "loc": [3083, 3083], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3079_C4", "vector": [14, 2, 0.7474, 0.0002, 2, 0.43, 0.5, 912, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "case_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " case_flags = NOCASE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3084_C8", "label": "for s", "type": "for", "loc": [3084, 3111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3079_C4", "vector": [6, 2, 0.7509, 0.0068, 2, 0.43, 0.6667, 553, 7, 0, 0, 0, 0, 0, 13], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for s in self.items:\n if type(s) is Character and s.positive:\n if s.case_flags != case_flags:\n # Different case sensitivity, so flush, unless neither the\n # previous nor the new character are cased.\n if s.case_flags or is_cased(info, s.value):\n Sequence._flush_characters(info, characters,\n case_flags, items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3085_C12", "label": "if", "type": "if", "loc": [3085, 3111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3084_C8", "vector": [4, 3, 0.751, 0.0065, 3, 0.76, 0.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if type(s) is Character and s.positive:\n if s.case_flags != case_flags:\n # Different case sensitivity, so flush, unless neither the\n # previous nor the new character are cased.\n if s.case_flags or is_cased(info, s.value):\n Sequence._flush_characters(info, characters,\n case_flags, items)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3086_C16", "label": "if", "type": "if", "loc": [3086, 3093], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3085_C12", "vector": [4, 4, 0.749, 0.0019, 4, 0.94, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if s.case_flags != case_flags:\n # Different case sensitivity, so flush, unless neither the\n # previous nor the new character are cased.\n if s.case_flags or is_cased(info, s.value):\n Sequence._flush_characters(info, characters,\n case_flags, items)\n\n case_flags = s.case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3089_C20", "label": "if", "type": "if", "loc": [3089, 3093], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3086_C16", "vector": [4, 5, 0.7493, 0.0012, 5, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if s.case_flags or is_cased(info, s.value):\n Sequence._flush_characters(info, characters,\n case_flags, items)\n\n case_flags = s.case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3090_C24", "label": "_flush_characters()", "type": "expression", "loc": [3090, 3091], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3089_C20", "vector": [8, 6, 0.7492, 0.0005, 6, 0.61, 0.0, 769, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "_flush_characters", "arg_names": [], "import_names": [], "rhs_call_name": "_flush_characters", "annotation": ""}, "snippet": " Sequence._flush_characters(info, characters,\n case_flags, items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3093_C24", "label": "case_flags =", "type": "assigned_variable", "loc": [3093, 3093], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3089_C20", "vector": [14, 6, 0.7498, 0.0002, 6, 0.61, 1.0, 912, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "case_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " case_flags = s.case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3095_C16", "label": "append()", "type": "expression", "loc": [3095, 3095], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3085_C12", "vector": [8, 4, 0.7503, 0.0002, 4, 0.94, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " characters.append(s.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3096_C12", "label": "if", "type": "if", "loc": [3096, 3111], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3085_C12", "vector": [4, 4, 0.7524, 0.0039, 4, 0.94, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif type(s) is String or type(s) is Literal:\n if s.case_flags != case_flags:\n # Different case sensitivity, so flush, unless the neither\n # the previous nor the new string are cased.\n if s.case_flags or any(is_cased(info, c) for c in\n characters):\n Sequence._flush_characters(info, characters,\n case_flags, items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3097_C16", "label": "if", "type": "if", "loc": [3097, 3105], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3096_C12", "vector": [4, 5, 0.7518, 0.0022, 5, 0.34, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if s.case_flags != case_flags:\n # Different case sensitivity, so flush, unless the neither\n # the previous nor the new string are cased.\n if s.case_flags or any(is_cased(info, c) for c in\n characters):\n Sequence._flush_characters(info, characters,\n case_flags, items)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3100_C20", "label": "if", "type": "if", "loc": [3100, 3105], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3097_C16", "vector": [4, 6, 0.7521, 0.0015, 6, 0.41, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if s.case_flags or any(is_cased(info, c) for c in\n characters):\n Sequence._flush_characters(info, characters,\n case_flags, items)\n\n case_flags = s.case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3102_C24", "label": "_flush_characters()", "type": "expression", "loc": [3102, 3103], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3100_C20", "vector": [8, 7, 0.7521, 0.0005, 7, 0.92, 0.0, 769, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "_flush_characters", "arg_names": [], "import_names": [], "rhs_call_name": "_flush_characters", "annotation": ""}, "snippet": " Sequence._flush_characters(info, characters,\n case_flags, items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3105_C24", "label": "case_flags =", "type": "assigned_variable", "loc": [3105, 3105], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3100_C20", "vector": [14, 7, 0.7527, 0.0002, 7, 0.92, 1.0, 912, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "case_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " case_flags = s.case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3107_C16", "label": "extend()", "type": "expression", "loc": [3107, 3107], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3096_C12", "vector": [8, 5, 0.7532, 0.0002, 5, 0.34, 0.3333, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " characters.extend(s.characters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3109_C16", "label": "_flush_characters()", "type": "expression", "loc": [3109, 3109], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3096_C12", "vector": [8, 5, 0.7537, 0.0002, 5, 0.34, 0.6667, 769, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "_flush_characters", "arg_names": [], "import_names": [], "rhs_call_name": "_flush_characters", "annotation": ""}, "snippet": " Sequence._flush_characters(info, characters, case_flags, items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3111_C16", "label": "append()", "type": "expression", "loc": [3111, 3111], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3096_C12", "vector": [8, 5, 0.7542, 0.0002, 5, 0.34, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " items.append(s.pack_characters(info))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3113_C8", "label": "_flush_characters()", "type": "expression", "loc": [3113, 3113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3079_C4", "vector": [8, 2, 0.7547, 0.0002, 2, 0.43, 0.8333, 769, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "_flush_characters", "arg_names": [], "import_names": [], "rhs_call_name": "_flush_characters", "annotation": ""}, "snippet": " Sequence._flush_characters(info, characters, case_flags, items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3115_C8", "label": "return", "type": "return", "loc": [3115, 3115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3079_C4", "vector": [13, 2, 0.7552, 0.0002, 2, 0.43, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return make_sequence(items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3117_C4", "label": "remove_captures", "type": "function", "loc": [3117, 3119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "vector": [2, 1, 0.7559, 0.0007, 1, 0.24, 0.25, 732, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "remove_captures", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove_captures(self):\n self.items = [s.remove_captures() for s in self.items]\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3118_C8", "label": "self.items =", "type": "assigned_variable", "loc": [3118, 3118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3117_C4", "vector": [14, 2, 0.7559, 0.0002, 2, 0.59, 0.0, 11, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.items = [s.remove_captures() for s in self.items]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3119_C8", "label": "return", "type": "return", "loc": [3119, 3119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3117_C4", "vector": [13, 2, 0.7561, 0.0002, 2, 0.59, 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_1389:FunctionDef_L3121_C4", "label": "is_atomic", "type": "function", "loc": [3121, 3122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "vector": [2, 1, 0.7567, 0.0005, 1, 0.24, 0.3125, 841, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "is_atomic", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_atomic(self):\n return all(s.is_atomic() for s in self.items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3122_C8", "label": "return", "type": "return", "loc": [3122, 3122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3121_C4", "vector": [13, 2, 0.7568, 0.0002, 2, 0.55, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return all(s.is_atomic() for s in self.items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3124_C4", "label": "can_be_affix", "type": "function", "loc": [3124, 3125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "vector": [2, 1, 0.7575, 0.0005, 1, 0.24, 0.375, 276, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "can_be_affix", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def can_be_affix(self):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3125_C8", "label": "return", "type": "return", "loc": [3125, 3125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3124_C4", "vector": [13, 2, 0.7576, 0.0002, 2, 0.57, 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_1389:FunctionDef_L3127_C4", "label": "contains_group", "type": "function", "loc": [3127, 3128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "vector": [2, 1, 0.7582, 0.0005, 1, 0.24, 0.4375, 206, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "contains_group", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def contains_group(self):\n return any(s.contains_group() for s in self.items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3128_C8", "label": "return", "type": "return", "loc": [3128, 3128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3127_C4", "vector": [13, 2, 0.7583, 0.0002, 2, 0.5, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return any(s.contains_group() for s in self.items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3130_C4", "label": "get_firstset", "type": "function", "loc": [3130, 3141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "vector": [2, 1, 0.7601, 0.0029, 1, 0.24, 0.5, 638, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "get_firstset", "arg_names": ["self", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_firstset(self, reverse):\n fs = set()\n items = self.items\n if reverse:\n items.reverse()\n for s in items:\n fs |= s.get_firstset(reverse)\n if None not in fs:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3131_C8", "label": "fs = set()", "type": "assigned_variable", "loc": [3131, 3131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3130_C4", "vector": [14, 2, 0.759, 0.0002, 2, 0.18, 0.0, 245, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "fs", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " fs = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3132_C8", "label": "items =", "type": "assigned_variable", "loc": [3132, 3132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3130_C4", "vector": [14, 2, 0.7593, 0.0002, 2, 0.18, 0.25, 339, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = self.items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3133_C8", "label": "if", "type": "if", "loc": [3133, 3134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3130_C4", "vector": [4, 2, 0.7596, 0.0005, 2, 0.18, 0.5, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if reverse:\n items.reverse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3134_C12", "label": "reverse()", "type": "expression", "loc": [3134, 3134], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3133_C8", "vector": [8, 3, 0.7598, 0.0002, 3, 0.01, 0.0, 109, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reverse", "arg_names": [], "import_names": [], "rhs_call_name": "reverse", "annotation": ""}, "snippet": " items.reverse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3135_C8", "label": "for s", "type": "for", "loc": [3135, 3139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3130_C4", "vector": [6, 2, 0.7605, 0.0012, 2, 0.18, 0.75, 553, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for s in items:\n fs |= s.get_firstset(reverse)\n if None not in fs:\n return fs\n fs.discard(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3137_C12", "label": "if", "type": "if", "loc": [3137, 3138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3135_C8", "vector": [4, 3, 0.7606, 0.0005, 3, 0.32, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if None not in fs:\n return fs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3138_C16", "label": "return", "type": "return", "loc": [3138, 3138], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3137_C12", "vector": [13, 4, 0.7607, 0.0002, 4, 0.56, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return fs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3139_C12", "label": "discard()", "type": "expression", "loc": [3139, 3139], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3135_C8", "vector": [8, 3, 0.761, 0.0002, 3, 0.32, 1.0, 437, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "discard", "arg_names": [], "import_names": [], "rhs_call_name": "discard", "annotation": ""}, "snippet": " fs.discard(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3141_C8", "label": "return", "type": "return", "loc": [3141, 3141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3130_C4", "vector": [13, 2, 0.7615, 0.0002, 2, 0.18, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return fs | set([None])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3143_C4", "label": "has_simple_start", "type": "function", "loc": [3143, 3144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "vector": [2, 1, 0.7621, 0.0005, 1, 0.24, 0.5625, 317, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "has_simple_start", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def has_simple_start(self):\n return self.items and self.items[0].has_simple_start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3144_C8", "label": "return", "type": "return", "loc": [3144, 3144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3143_C4", "vector": [13, 2, 0.7622, 0.0002, 2, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.items and self.items[0].has_simple_start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3146_C4", "label": "_compile", "type": "function", "loc": [3146, 3155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "vector": [2, 1, 0.7638, 0.0024, 1, 0.24, 0.625, 779, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n seq = self.items\n if reverse:\n seq = seq[::-1]\n\n code = []\n for s in seq:\n code.extend(s.compile(reverse, fuzzy))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3147_C8", "label": "seq =", "type": "assigned_variable", "loc": [3147, 3147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3146_C4", "vector": [14, 2, 0.7629, 0.0002, 2, 0.14, 0.0, 609, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "seq", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " seq = self.items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3148_C8", "label": "if", "type": "if", "loc": [3148, 3149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3146_C4", "vector": [4, 2, 0.7633, 0.0005, 2, 0.14, 0.25, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if reverse:\n seq = seq[::-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3149_C12", "label": "seq =", "type": "assigned_variable", "loc": [3149, 3149], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3148_C8", "vector": [14, 3, 0.7634, 0.0002, 3, 0.66, 0.0, 609, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "seq", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " seq = seq[::-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3151_C8", "label": "code =", "type": "assigned_variable", "loc": [3151, 3151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3146_C4", "vector": [14, 2, 0.7639, 0.0002, 2, 0.14, 0.5, 44, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " code = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3152_C8", "label": "for s", "type": "for", "loc": [3152, 3153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3146_C4", "vector": [6, 2, 0.7642, 0.0005, 2, 0.14, 0.75, 553, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for s in seq:\n code.extend(s.compile(reverse, fuzzy))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3153_C12", "label": "extend()", "type": "expression", "loc": [3153, 3153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3152_C8", "vector": [8, 3, 0.7644, 0.0002, 3, 0.38, 0.0, 660, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " code.extend(s.compile(reverse, fuzzy))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3155_C8", "label": "return", "type": "return", "loc": [3155, 3155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3146_C4", "vector": [13, 2, 0.7648, 0.0002, 2, 0.14, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3157_C4", "label": "_dump", "type": "function", "loc": [3157, 3159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "vector": [2, 1, 0.7656, 0.0007, 1, 0.24, 0.6875, 656, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n for s in self.items:\n s.dump(indent, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3158_C8", "label": "for s", "type": "for", "loc": [3158, 3159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3157_C4", "vector": [6, 2, 0.7657, 0.0005, 2, 0.89, 0.0, 553, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for s in self.items:\n s.dump(indent, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3159_C12", "label": "dump()", "type": "expression", "loc": [3159, 3159], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3158_C8", "vector": [8, 3, 0.7658, 0.0002, 3, 0.25, 0.0, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " s.dump(indent, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3162_C4", "label": "_flush_characters", "type": "function", "loc": [3162, 3176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "vector": [2, 1, 0.7682, 0.0036, 1, 0.24, 0.75, 769, 0, 4, 0, 0, 0, 0, 7], "semantic": {"name": "_flush_characters", "arg_names": ["info", "characters", "case_flags", "items"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _flush_characters(info, characters, case_flags, items):\n if not characters:\n return\n\n # Disregard case_flags if all of the characters are case-less.\n if case_flags & IGNORECASE:\n if not any(is_cased(info, c) for c in characters):\n case_flags = NOCASE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3163_C8", "label": "if", "type": "if", "loc": [3163, 3164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3162_C4", "vector": [4, 2, 0.7669, 0.0005, 2, 0.57, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not characters:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3164_C12", "label": "return", "type": "return", "loc": [3164, 3164], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3163_C8", "vector": [13, 3, 0.767, 0.0002, 3, 0.66, 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_1389:If_L3167_C8", "label": "if", "type": "if", "loc": [3167, 3169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3162_C4", "vector": [4, 2, 0.768, 0.0007, 2, 0.57, 0.3333, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if case_flags & IGNORECASE:\n if not any(is_cased(info, c) for c in characters):\n case_flags = NOCASE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3168_C12", "label": "if", "type": "if", "loc": [3168, 3169], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3167_C8", "vector": [4, 3, 0.7681, 0.0005, 3, 0.43, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not any(is_cased(info, c) for c in characters):\n case_flags = NOCASE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3169_C16", "label": "case_flags =", "type": "assigned_variable", "loc": [3169, 3169], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3168_C12", "vector": [14, 4, 0.7682, 0.0002, 4, 0.06, 0.0, 912, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "case_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " case_flags = NOCASE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3171_C8", "label": "if", "type": "if", "loc": [3171, 3174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3162_C4", "vector": [4, 2, 0.7691, 0.001, 2, 0.57, 0.6667, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(characters) == 1:\n items.append(Character(characters[0], case_flags=case_flags))\n else:\n items.append(String(characters, case_flags=case_flags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3172_C12", "label": "append()", "type": "expression", "loc": [3172, 3172], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3171_C8", "vector": [8, 3, 0.769, 0.0002, 3, 0.23, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " items.append(Character(characters[0], case_flags=case_flags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3174_C12", "label": "append()", "type": "expression", "loc": [3174, 3174], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3171_C8", "vector": [8, 3, 0.7695, 0.0002, 3, 0.23, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " items.append(String(characters, case_flags=case_flags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3176_C8", "label": "assign", "type": "assigned_variable", "loc": [3176, 3176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3162_C4", "vector": [14, 2, 0.7699, 0.0002, 2, 0.57, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " characters[:] = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3178_C4", "label": "is_empty", "type": "function", "loc": [3178, 3179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "vector": [2, 1, 0.7705, 0.0005, 1, 0.24, 0.8125, 623, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "is_empty", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_empty(self):\n return all(i.is_empty() for i in self.items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3179_C8", "label": "return", "type": "return", "loc": [3179, 3179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3178_C4", "vector": [13, 2, 0.7707, 0.0002, 2, 0.56, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return all(i.is_empty() for i in self.items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3181_C4", "label": "__eq__", "type": "function", "loc": [3181, 3182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "vector": [2, 1, 0.7713, 0.0005, 1, 0.24, 0.875, 763, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n return type(self) is type(other) and self.items == other.items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3182_C8", "label": "return", "type": "return", "loc": [3182, 3182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3181_C4", "vector": [13, 2, 0.7714, 0.0002, 2, 0.43, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return type(self) is type(other) and self.items == other.items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3184_C4", "label": "max_width", "type": "function", "loc": [3184, 3185], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "vector": [2, 1, 0.772, 0.0005, 1, 0.24, 0.9375, 0, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "max_width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_width(self):\n return sum(s.max_width() for s in self.items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3185_C8", "label": "return", "type": "return", "loc": [3185, 3185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3184_C4", "vector": [13, 2, 0.7721, 0.0002, 2, 0.9, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sum(s.max_width() for s in self.items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3187_C4", "label": "get_required_string", "type": "function", "loc": [3187, 3200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "vector": [2, 1, 0.7742, 0.0034, 1, 0.24, 1.0, 720, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_required_string", "arg_names": ["self", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_required_string(self, reverse):\n seq = self.items\n if reverse:\n seq = seq[::-1]\n\n offset = 0\n\n for s in seq:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3188_C8", "label": "seq =", "type": "assigned_variable", "loc": [3188, 3188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3187_C4", "vector": [14, 2, 0.7728, 0.0002, 2, 0.18, 0.0, 609, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "seq", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " seq = self.items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3189_C8", "label": "if", "type": "if", "loc": [3189, 3190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3187_C4", "vector": [4, 2, 0.7732, 0.0005, 2, 0.18, 0.25, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if reverse:\n seq = seq[::-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3190_C12", "label": "seq =", "type": "assigned_variable", "loc": [3190, 3190], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3189_C8", "vector": [14, 3, 0.7733, 0.0002, 3, 0.24, 0.0, 609, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "seq", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " seq = seq[::-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3192_C8", "label": "offset =", "type": "assigned_variable", "loc": [3192, 3192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3187_C4", "vector": [14, 2, 0.7738, 0.0002, 2, 0.18, 0.5, 132, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "offset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " offset = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3194_C8", "label": "for s", "type": "for", "loc": [3194, 3198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3187_C4", "vector": [6, 2, 0.7748, 0.0012, 2, 0.18, 0.75, 553, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for s in seq:\n ofs, req = s.get_required_string(reverse)\n offset += ofs\n if req:\n return offset, req"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3195_C12", "label": "ofs, req = get_required_string()", "type": "assigned_variable", "loc": [3195, 3195], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3194_C8", "vector": [14, 3, 0.7745, 0.0002, 3, 0.94, 0.0, 354, 3, 1, 0, 0, 720, 10, 1], "semantic": {"name": "ofs, req", "arg_names": [], "import_names": [], "rhs_call_name": "get_required_string", "annotation": ""}, "snippet": " ofs, req = s.get_required_string(reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3197_C12", "label": "if", "type": "if", "loc": [3197, 3198], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3194_C8", "vector": [4, 3, 0.7752, 0.0005, 3, 0.94, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if req:\n return offset, req"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3198_C16", "label": "return", "type": "return", "loc": [3198, 3198], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3197_C12", "vector": [13, 4, 0.7753, 0.0002, 4, 0.57, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return offset, req"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3200_C8", "label": "return", "type": "return", "loc": [3200, 3200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3187_C4", "vector": [13, 2, 0.7758, 0.0002, 2, 0.18, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return offset, None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3202_C0", "label": "SetBase", "type": "class", "loc": [3202, 3303], "level": 0, "parent": null, "vector": [3, 0, 0.7885, 0.0247, 0, 0.66, 0.8756, 71, 0, 8, 0, 0, 852, 0, 32], "semantic": {"name": "SetBase", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SetBase(RegexBase):\n def __init__(self, info, items, positive=True, case_flags=NOCASE,\n zerowidth=False):\n RegexBase.__init__(self)\n self.info = info\n self.items = tuple(items)\n self.positive = bool(positive)\n self.case_flags = case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3203_C4", "label": "__init__", "type": "function", "loc": [3203, 3215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3202_C0", "vector": [2, 1, 0.7779, 0.0032, 1, 0.83, 0.0, 555, 0, 6, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "info", "items", "positive", "case_flags", "zerowidth"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, info, items, positive=True, case_flags=NOCASE,\n zerowidth=False):\n RegexBase.__init__(self)\n self.info = info\n self.items = tuple(items)\n self.positive = bool(positive)\n self.case_flags = case_flags\n self.zerowidth = bool(zerowidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3205_C8", "label": "__init__()", "type": "expression", "loc": [3205, 3205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3203_C4", "vector": [8, 2, 0.777, 0.0002, 2, 0.4, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " RegexBase.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3206_C8", "label": "self.info =", "type": "assigned_variable", "loc": [3206, 3206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3203_C4", "vector": [14, 2, 0.7772, 0.0002, 2, 0.4, 0.1429, 264, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.info = info"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3207_C8", "label": "self.items = tuple()", "type": "assigned_variable", "loc": [3207, 3207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3203_C4", "vector": [14, 2, 0.7775, 0.0002, 2, 0.4, 0.2857, 11, 3, 1, 0, 0, 259, 10, 1], "semantic": {"name": "self.items", "arg_names": [], "import_names": [], "rhs_call_name": "tuple", "annotation": ""}, "snippet": " self.items = tuple(items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3208_C8", "label": "self.positive = bool()", "type": "assigned_variable", "loc": [3208, 3208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3203_C4", "vector": [14, 2, 0.7777, 0.0002, 2, 0.4, 0.4286, 226, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "self.positive", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " self.positive = bool(positive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3209_C8", "label": "self.case_flags =", "type": "assigned_variable", "loc": [3209, 3209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3203_C4", "vector": [14, 2, 0.7779, 0.0002, 2, 0.4, 0.5714, 56, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.case_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.case_flags = case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3210_C8", "label": "self.zerowidth = bool()", "type": "assigned_variable", "loc": [3210, 3210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3203_C4", "vector": [14, 2, 0.7782, 0.0002, 2, 0.4, 0.7143, 68, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "self.zerowidth", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " self.zerowidth = bool(zerowidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3212_C8", "label": "self.char_width =", "type": "assigned_variable", "loc": [3212, 3212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3203_C4", "vector": [14, 2, 0.7787, 0.0002, 2, 0.4, 0.8571, 464, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.char_width", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.char_width = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3214_C8", "label": "self._key =", "type": "assigned_variable", "loc": [3214, 3215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3203_C4", "vector": [14, 2, 0.7793, 0.0005, 2, 0.4, 1.0, 449, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "self._key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._key = (self.__class__, self.items, self.positive,\n self.case_flags, self.zerowidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3217_C4", "label": "rebuild", "type": "function", "loc": [3217, 3219], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3202_C0", "vector": [2, 1, 0.7801, 0.0007, 1, 0.83, 0.1429, 486, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "rebuild", "arg_names": ["self", "positive", "case_flags", "zerowidth"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def rebuild(self, positive, case_flags, zerowidth):\n return type(self)(self.info, self.items, positive, case_flags,\n zerowidth).optimise(self.info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3218_C8", "label": "return", "type": "return", "loc": [3218, 3219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3217_C4", "vector": [13, 2, 0.7802, 0.0005, 2, 0.74, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return type(self)(self.info, self.items, positive, case_flags,\n zerowidth).optimise(self.info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3221_C4", "label": "get_firstset", "type": "function", "loc": [3221, 3222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3202_C0", "vector": [2, 1, 0.781, 0.0005, 1, 0.83, 0.2857, 638, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_firstset", "arg_names": ["self", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_firstset(self, reverse):\n return set([self])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3222_C8", "label": "return", "type": "return", "loc": [3222, 3222], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3221_C4", "vector": [13, 2, 0.7811, 0.0002, 2, 0.7, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return set([self])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3224_C4", "label": "has_simple_start", "type": "function", "loc": [3224, 3225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3202_C0", "vector": [2, 1, 0.7817, 0.0005, 1, 0.83, 0.4286, 317, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "has_simple_start", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def has_simple_start(self):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3225_C8", "label": "return", "type": "return", "loc": [3225, 3225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3224_C4", "vector": [13, 2, 0.7818, 0.0002, 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 True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3227_C4", "label": "_compile", "type": "function", "loc": [3227, 3241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3202_C0", "vector": [2, 1, 0.784, 0.0036, 1, 0.83, 0.5714, 779, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n flags = 0\n if self.positive:\n flags |= POSITIVE_OP\n if self.zerowidth:\n flags |= ZEROWIDTH_OP\n if fuzzy:\n flags |= FUZZY_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3228_C8", "label": "flags =", "type": "assigned_variable", "loc": [3228, 3228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3227_C4", "vector": [14, 2, 0.7825, 0.0002, 2, 0.36, 0.0, 375, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " flags = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3229_C8", "label": "if", "type": "if", "loc": [3229, 3230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3227_C4", "vector": [4, 2, 0.7829, 0.0005, 2, 0.36, 0.1429, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.positive:\n flags |= POSITIVE_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3231_C8", "label": "if", "type": "if", "loc": [3231, 3232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3227_C4", "vector": [4, 2, 0.7834, 0.0005, 2, 0.36, 0.2857, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.zerowidth:\n flags |= ZEROWIDTH_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3233_C8", "label": "if", "type": "if", "loc": [3233, 3234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3227_C4", "vector": [4, 2, 0.7839, 0.0005, 2, 0.36, 0.4286, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if fuzzy:\n flags |= FUZZY_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3235_C8", "label": "code =", "type": "assigned_variable", "loc": [3235, 3235], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3227_C4", "vector": [14, 2, 0.7842, 0.0002, 2, 0.36, 0.5714, 44, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " code = [(self._opcode[self.case_flags, reverse], flags)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3236_C8", "label": "for m", "type": "for", "loc": [3236, 3237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3227_C4", "vector": [6, 2, 0.7846, 0.0005, 2, 0.36, 0.7143, 711, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for m in self.items:\n code.extend(m.compile())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3237_C12", "label": "extend()", "type": "expression", "loc": [3237, 3237], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3236_C8", "vector": [8, 3, 0.7847, 0.0002, 3, 0.37, 0.0, 660, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " code.extend(m.compile())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3239_C8", "label": "append()", "type": "expression", "loc": [3239, 3239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3227_C4", "vector": [8, 2, 0.7852, 0.0002, 2, 0.36, 0.8571, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " code.append((OP.END, ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3241_C8", "label": "return", "type": "return", "loc": [3241, 3241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3227_C4", "vector": [13, 2, 0.7857, 0.0002, 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 code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3243_C4", "label": "_dump", "type": "function", "loc": [3243, 3247], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3202_C0", "vector": [2, 1, 0.7867, 0.0012, 1, 0.83, 0.7143, 656, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n print(\"{}{} {}{}\".format(INDENT * indent, self._op_name,\n POS_TEXT[self.positive], CASE_TEXT[self.case_flags]))\n for i in self.items:\n i.dump(indent + 1, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3244_C8", "label": "print()", "type": "expression", "loc": [3244, 3245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3243_C4", "vector": [8, 2, 0.7865, 0.0005, 2, 0.34, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}{} {}{}\".format(INDENT * indent, self._op_name,\n POS_TEXT[self.positive], CASE_TEXT[self.case_flags]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3246_C8", "label": "for i", "type": "for", "loc": [3246, 3247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3243_C4", "vector": [6, 2, 0.787, 0.0005, 2, 0.34, 1.0, 826, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in self.items:\n i.dump(indent + 1, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3247_C12", "label": "dump()", "type": "expression", "loc": [3247, 3247], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3246_C8", "vector": [8, 3, 0.7872, 0.0002, 3, 0.96, 0.0, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " i.dump(indent + 1, reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3249_C4", "label": "_handle_case_folding", "type": "function", "loc": [3249, 3278], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3202_C0", "vector": [2, 1, 0.7912, 0.0073, 1, 0.83, 0.8571, 464, 0, 3, 1, 0, 0, 0, 10], "semantic": {"name": "_handle_case_folding", "arg_names": ["self", "info", "in_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _handle_case_folding(self, info, in_set):\n # Is the set case-sensitive?\n if not self.positive or not (self.case_flags & IGNORECASE) or in_set:\n return self\n\n # Is full case-folding possible?\n if (not (self.info.flags & UNICODE) or (self.case_flags &\n FULLIGNORECASE) !="}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3251_C8", "label": "if", "type": "if", "loc": [3251, 3252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3249_C4", "vector": [4, 2, 0.7882, 0.0005, 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 not self.positive or not (self.case_flags & IGNORECASE) or in_set:\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3252_C12", "label": "return", "type": "return", "loc": [3252, 3252], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3251_C8", "vector": [13, 3, 0.7884, 0.0002, 3, 0.55, 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_1389:If_L3255_C8", "label": "if", "type": "if", "loc": [3255, 3258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3249_C4", "vector": [4, 2, 0.7895, 0.001, 2, 0.22, 0.1429, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not (self.info.flags & UNICODE) or (self.case_flags &\n FULLIGNORECASE) !=\n FULLIGNORECASE):\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3258_C12", "label": "return", "type": "return", "loc": [3258, 3258], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3255_C8", "vector": [13, 3, 0.7898, 0.0002, 3, 0.43, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3261_C8", "label": "expanding_chars = get_expand_on_folding()", "type": "assigned_variable", "loc": [3261, 3261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3249_C4", "vector": [14, 2, 0.7905, 0.0002, 2, 0.22, 0.2857, 347, 3, 0, 0, 0, 869, 10, 1], "semantic": {"name": "expanding_chars", "arg_names": [], "import_names": [], "rhs_call_name": "get_expand_on_folding", "annotation": ""}, "snippet": " expanding_chars = _regex.get_expand_on_folding()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3264_C8", "label": "items =", "type": "assigned_variable", "loc": [3264, 3264], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3249_C4", "vector": [14, 2, 0.7913, 0.0002, 2, 0.22, 0.4286, 339, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3265_C8", "label": "seen = set()", "type": "assigned_variable", "loc": [3265, 3265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3249_C4", "vector": [14, 2, 0.7915, 0.0002, 2, 0.22, 0.5714, 212, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "seen", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " seen = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3266_C8", "label": "for ch", "type": "for", "loc": [3266, 3272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3249_C4", "vector": [6, 2, 0.7925, 0.0017, 2, 0.22, 0.7143, 263, 2, 0, 0, 0, 0, 0, 7], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ch in expanding_chars:\n if self.matches(ord(ch)):\n folded = _regex.fold_case(FULL_CASE_FOLDING, ch)\n if folded not in seen:\n items.append(String([ord(c) for c in folded],\n case_flags=self.case_flags))\n seen.add(folded)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3267_C12", "label": "if", "type": "if", "loc": [3267, 3272], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3266_C8", "vector": [4, 3, 0.7926, 0.0015, 3, 0.6, 0.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.matches(ord(ch)):\n folded = _regex.fold_case(FULL_CASE_FOLDING, ch)\n if folded not in seen:\n items.append(String([ord(c) for c in folded],\n case_flags=self.case_flags))\n seen.add(folded)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3268_C16", "label": "folded = fold_case()", "type": "assigned_variable", "loc": [3268, 3268], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3267_C12", "vector": [14, 4, 0.7922, 0.0002, 4, 0.07, 0.0, 68, 3, 2, 0, 0, 184, 10, 1], "semantic": {"name": "folded", "arg_names": [], "import_names": [], "rhs_call_name": "fold_case", "annotation": ""}, "snippet": " folded = _regex.fold_case(FULL_CASE_FOLDING, ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3269_C16", "label": "if", "type": "if", "loc": [3269, 3272], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3267_C12", "vector": [4, 4, 0.7928, 0.001, 4, 0.07, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if folded not in seen:\n items.append(String([ord(c) for c in folded],\n case_flags=self.case_flags))\n seen.add(folded)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3270_C20", "label": "append()", "type": "expression", "loc": [3270, 3271], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3269_C16", "vector": [8, 5, 0.7928, 0.0005, 5, 0.25, 0.0, 243, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " items.append(String([ord(c) for c in folded],\n case_flags=self.case_flags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3272_C20", "label": "add()", "type": "expression", "loc": [3272, 3272], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3269_C16", "vector": [8, 5, 0.7932, 0.0002, 5, 0.25, 1.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " seen.add(folded)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3274_C8", "label": "if", "type": "if", "loc": [3274, 3276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3249_C4", "vector": [4, 2, 0.7939, 0.0007, 2, 0.22, 0.8571, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not items:\n # We can fall back to simple case-folding.\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3276_C12", "label": "return", "type": "return", "loc": [3276, 3276], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3274_C8", "vector": [13, 3, 0.7942, 0.0002, 3, 0.78, 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_1389:Return_L3278_C8", "label": "return", "type": "return", "loc": [3278, 3278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3249_C4", "vector": [13, 2, 0.7947, 0.0002, 2, 0.22, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Branch([self] + items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3280_C4", "label": "max_width", "type": "function", "loc": [3280, 3303], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3202_C0", "vector": [2, 1, 0.7979, 0.0058, 1, 0.83, 1.0, 0, 0, 1, 1, 0, 0, 0, 8], "semantic": {"name": "max_width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_width(self):\n # Is the set case-sensitive?\n if not self.positive or not (self.case_flags & IGNORECASE):\n return 1\n\n # Is full case-folding possible?\n if (not (self.info.flags & UNICODE) or (self.case_flags &\n FULLIGNORECASE) != FULLIGNORECASE):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3282_C8", "label": "if", "type": "if", "loc": [3282, 3283], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3280_C4", "vector": [4, 2, 0.7958, 0.0005, 2, 0.24, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.positive or not (self.case_flags & IGNORECASE):\n return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3283_C12", "label": "return", "type": "return", "loc": [3283, 3283], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3282_C8", "vector": [13, 3, 0.7959, 0.0002, 3, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3286_C8", "label": "if", "type": "if", "loc": [3286, 3288], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3280_C4", "vector": [4, 2, 0.7968, 0.0007, 2, 0.24, 0.1667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not (self.info.flags & UNICODE) or (self.case_flags &\n FULLIGNORECASE) != FULLIGNORECASE):\n return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3288_C12", "label": "return", "type": "return", "loc": [3288, 3288], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3286_C8", "vector": [13, 3, 0.7971, 0.0002, 3, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3291_C8", "label": "expanding_chars = get_expand_on_folding()", "type": "assigned_variable", "loc": [3291, 3291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3280_C4", "vector": [14, 2, 0.7978, 0.0002, 2, 0.24, 0.3333, 347, 3, 0, 0, 0, 869, 10, 1], "semantic": {"name": "expanding_chars", "arg_names": [], "import_names": [], "rhs_call_name": "get_expand_on_folding", "annotation": ""}, "snippet": " expanding_chars = _regex.get_expand_on_folding()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3294_C8", "label": "seen = set()", "type": "assigned_variable", "loc": [3294, 3294], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3280_C4", "vector": [14, 2, 0.7985, 0.0002, 2, 0.24, 0.5, 212, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "seen", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " seen = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3295_C8", "label": "for ch", "type": "for", "loc": [3295, 3298], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3280_C4", "vector": [6, 2, 0.7992, 0.001, 2, 0.24, 0.6667, 263, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ch in expanding_chars:\n if self.matches(ord(ch)):\n folded = _regex.fold_case(FULL_CASE_FOLDING, ch)\n seen.add(folded)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3296_C12", "label": "if", "type": "if", "loc": [3296, 3298], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3295_C8", "vector": [4, 3, 0.7993, 0.0007, 3, 0.09, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.matches(ord(ch)):\n folded = _regex.fold_case(FULL_CASE_FOLDING, ch)\n seen.add(folded)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3297_C16", "label": "folded = fold_case()", "type": "assigned_variable", "loc": [3297, 3297], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3296_C12", "vector": [14, 4, 0.7993, 0.0002, 4, 0.93, 0.0, 68, 3, 2, 0, 0, 184, 10, 1], "semantic": {"name": "folded", "arg_names": [], "import_names": [], "rhs_call_name": "fold_case", "annotation": ""}, "snippet": " folded = _regex.fold_case(FULL_CASE_FOLDING, ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3298_C16", "label": "add()", "type": "expression", "loc": [3298, 3298], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3296_C12", "vector": [8, 4, 0.7995, 0.0002, 4, 0.93, 1.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " seen.add(folded)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3300_C8", "label": "if", "type": "if", "loc": [3300, 3301], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3280_C4", "vector": [4, 2, 0.8001, 0.0005, 2, 0.24, 0.8333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not seen:\n return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3301_C12", "label": "return", "type": "return", "loc": [3301, 3301], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3300_C8", "vector": [13, 3, 0.8002, 0.0002, 3, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3303_C8", "label": "return", "type": "return", "loc": [3303, 3303], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3280_C4", "vector": [13, 2, 0.8007, 0.0002, 2, 0.24, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return max(len(folded) for folded in seen)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3305_C0", "label": "SetDiff", "type": "class", "loc": [3305, 3328], "level": 0, "parent": null, "vector": [3, 0, 0.804, 0.0058, 0, 0.66, 0.8808, 465, 0, 2, 0, 0, 71, 0, 10], "semantic": {"name": "SetDiff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SetDiff(SetBase):\n _opcode = {(NOCASE, False): OP.SET_DIFF, (IGNORECASE, False):\n OP.SET_DIFF_IGN, (FULLCASE, False): OP.SET_DIFF, (FULLIGNORECASE, False):\n OP.SET_DIFF_IGN, (NOCASE, True): OP.SET_DIFF_REV, (IGNORECASE, True):\n OP.SET_DIFF_IGN_REV, (FULLCASE, True): OP.SET_DIFF_REV, (FULLIGNORECASE,\n True): OP.SET_DIFF_IGN_REV}\n _op_name = \"SET_DIFF\"\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3306_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [3306, 3310], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3305_C0", "vector": [14, 1, 0.8019, 0.0012, 1, 0.91, 0.0, 52, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = {(NOCASE, False): OP.SET_DIFF, (IGNORECASE, False):\n OP.SET_DIFF_IGN, (FULLCASE, False): OP.SET_DIFF, (FULLIGNORECASE, False):\n OP.SET_DIFF_IGN, (NOCASE, True): OP.SET_DIFF_REV, (IGNORECASE, True):\n OP.SET_DIFF_IGN_REV, (FULLCASE, True): OP.SET_DIFF_REV, (FULLIGNORECASE,\n True): OP.SET_DIFF_IGN_REV}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3311_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [3311, 3311], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3305_C0", "vector": [14, 1, 0.8027, 0.0002, 1, 0.91, 0.3333, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"SET_DIFF\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3313_C4", "label": "optimise", "type": "function", "loc": [3313, 3324], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3305_C0", "vector": [2, 1, 0.8045, 0.0029, 1, 0.91, 0.6667, 265, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "optimise", "arg_names": ["self", "info", "in_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def optimise(self, info, in_set=False):\n items = self.items\n if len(items) > 2:\n items = [items[0], SetUnion(info, items[1 : ])]\n\n if len(items) == 1:\n return items[0].with_flags(case_flags=self.case_flags,\n zerowidth=self.zerowidth).optimise(info, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3314_C8", "label": "items =", "type": "assigned_variable", "loc": [3314, 3314], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3313_C4", "vector": [14, 2, 0.8034, 0.0002, 2, 0.18, 0.0, 339, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = self.items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3315_C8", "label": "if", "type": "if", "loc": [3315, 3316], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3313_C4", "vector": [4, 2, 0.8038, 0.0005, 2, 0.18, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(items) > 2:\n items = [items[0], SetUnion(info, items[1 : ])]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3316_C12", "label": "items =", "type": "assigned_variable", "loc": [3316, 3316], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3315_C8", "vector": [14, 3, 0.8039, 0.0002, 3, 0.72, 0.0, 339, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = [items[0], SetUnion(info, items[1 : ])]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3318_C8", "label": "if", "type": "if", "loc": [3318, 3320], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3313_C4", "vector": [4, 2, 0.8046, 0.0007, 2, 0.18, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(items) == 1:\n return items[0].with_flags(case_flags=self.case_flags,\n zerowidth=self.zerowidth).optimise(info, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3319_C12", "label": "return", "type": "return", "loc": [3319, 3320], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3318_C8", "vector": [13, 3, 0.8047, 0.0005, 3, 0.1, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return items[0].with_flags(case_flags=self.case_flags,\n zerowidth=self.zerowidth).optimise(info, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3322_C8", "label": "self.items = tuple()", "type": "assigned_variable", "loc": [3322, 3322], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3313_C4", "vector": [14, 2, 0.8053, 0.0002, 2, 0.18, 0.75, 11, 3, 1, 0, 0, 259, 10, 2], "semantic": {"name": "self.items", "arg_names": [], "import_names": [], "rhs_call_name": "tuple", "annotation": ""}, "snippet": " self.items = tuple(m.optimise(info, in_set=True) for m in items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3324_C8", "label": "return", "type": "return", "loc": [3324, 3324], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3313_C4", "vector": [13, 2, 0.8058, 0.0002, 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._handle_case_folding(info, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3326_C4", "label": "matches", "type": "function", "loc": [3326, 3328], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3305_C0", "vector": [2, 1, 0.8065, 0.0007, 1, 0.91, 1.0, 684, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "matches", "arg_names": ["self", "ch"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def matches(self, ch):\n m = self.items[0].matches(ch) and not self.items[1].matches(ch)\n return m == self.positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3327_C8", "label": "m =", "type": "assigned_variable", "loc": [3327, 3327], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3326_C4", "vector": [14, 2, 0.8065, 0.0002, 2, 0.79, 0.0, 711, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " m = self.items[0].matches(ch) and not self.items[1].matches(ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3328_C8", "label": "return", "type": "return", "loc": [3328, 3328], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3326_C4", "vector": [13, 2, 0.8068, 0.0002, 2, 0.79, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return m == self.positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3330_C0", "label": "SetInter", "type": "class", "loc": [3330, 3358], "level": 0, "parent": null, "vector": [3, 0, 0.8107, 0.007, 0, 0.66, 0.886, 54, 0, 2, 0, 0, 71, 0, 11], "semantic": {"name": "SetInter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SetInter(SetBase):\n _opcode = {(NOCASE, False): OP.SET_INTER, (IGNORECASE, False):\n OP.SET_INTER_IGN, (FULLCASE, False): OP.SET_INTER, (FULLIGNORECASE,\n False): OP.SET_INTER_IGN, (NOCASE, True): OP.SET_INTER_REV, (IGNORECASE,\n True): OP.SET_INTER_IGN_REV, (FULLCASE, True): OP.SET_INTER_REV,\n (FULLIGNORECASE, True): OP.SET_INTER_IGN_REV}\n _op_name = \"SET_INTER\"\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3331_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [3331, 3335], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3330_C0", "vector": [14, 1, 0.808, 0.0012, 1, 0.23, 0.0, 52, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = {(NOCASE, False): OP.SET_INTER, (IGNORECASE, False):\n OP.SET_INTER_IGN, (FULLCASE, False): OP.SET_INTER, (FULLIGNORECASE,\n False): OP.SET_INTER_IGN, (NOCASE, True): OP.SET_INTER_REV, (IGNORECASE,\n True): OP.SET_INTER_IGN_REV, (FULLCASE, True): OP.SET_INTER_REV,\n (FULLIGNORECASE, True): OP.SET_INTER_IGN_REV}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3336_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [3336, 3336], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3330_C0", "vector": [14, 1, 0.8087, 0.0002, 1, 0.23, 0.3333, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"SET_INTER\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3338_C4", "label": "optimise", "type": "function", "loc": [3338, 3354], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3330_C0", "vector": [2, 1, 0.8112, 0.0041, 1, 0.23, 0.6667, 265, 0, 3, 1, 0, 0, 0, 9], "semantic": {"name": "optimise", "arg_names": ["self", "info", "in_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def optimise(self, info, in_set=False):\n items = []\n for m in self.items:\n m = m.optimise(info, in_set=True)\n if isinstance(m, SetInter) and m.positive:\n # Intersection in intersection.\n items.extend(m.items)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3339_C8", "label": "items =", "type": "assigned_variable", "loc": [3339, 3339], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3338_C4", "vector": [14, 2, 0.8095, 0.0002, 2, 0.22, 0.0, 339, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3340_C8", "label": "for m", "type": "for", "loc": [3340, 3346], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3338_C4", "vector": [6, 2, 0.8104, 0.0017, 2, 0.22, 0.25, 711, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for m in self.items:\n m = m.optimise(info, in_set=True)\n if isinstance(m, SetInter) and m.positive:\n # Intersection in intersection.\n items.extend(m.items)\n else:\n items.append(m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3341_C12", "label": "m = optimise()", "type": "assigned_variable", "loc": [3341, 3341], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3340_C8", "vector": [14, 3, 0.8099, 0.0002, 3, 0.19, 0.0, 711, 3, 2, 0, 0, 265, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "optimise", "annotation": ""}, "snippet": " m = m.optimise(info, in_set=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3342_C12", "label": "if", "type": "if", "loc": [3342, 3346], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3340_C8", "vector": [4, 3, 0.8107, 0.0012, 3, 0.19, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(m, SetInter) and m.positive:\n # Intersection in intersection.\n items.extend(m.items)\n else:\n items.append(m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3344_C16", "label": "extend()", "type": "expression", "loc": [3344, 3344], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3342_C12", "vector": [8, 4, 0.8107, 0.0002, 4, 0.5, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " items.extend(m.items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3346_C16", "label": "append()", "type": "expression", "loc": [3346, 3346], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3342_C12", "vector": [8, 4, 0.8112, 0.0002, 4, 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": " items.append(m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3348_C8", "label": "if", "type": "if", "loc": [3348, 3350], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3338_C4", "vector": [4, 2, 0.8119, 0.0007, 2, 0.22, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(items) == 1:\n return items[0].with_flags(case_flags=self.case_flags,\n zerowidth=self.zerowidth).optimise(info, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3349_C12", "label": "return", "type": "return", "loc": [3349, 3350], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3348_C8", "vector": [13, 3, 0.812, 0.0005, 3, 0.0, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return items[0].with_flags(case_flags=self.case_flags,\n zerowidth=self.zerowidth).optimise(info, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3352_C8", "label": "self.items = tuple()", "type": "assigned_variable", "loc": [3352, 3352], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3338_C4", "vector": [14, 2, 0.8126, 0.0002, 2, 0.22, 0.75, 11, 3, 1, 0, 0, 259, 10, 1], "semantic": {"name": "self.items", "arg_names": [], "import_names": [], "rhs_call_name": "tuple", "annotation": ""}, "snippet": " self.items = tuple(items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3354_C8", "label": "return", "type": "return", "loc": [3354, 3354], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3338_C4", "vector": [13, 2, 0.8131, 0.0002, 2, 0.22, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._handle_case_folding(info, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3356_C4", "label": "matches", "type": "function", "loc": [3356, 3358], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3330_C0", "vector": [2, 1, 0.8138, 0.0007, 1, 0.23, 1.0, 684, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "matches", "arg_names": ["self", "ch"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def matches(self, ch):\n m = all(i.matches(ch) for i in self.items)\n return m == self.positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3357_C8", "label": "m = all()", "type": "assigned_variable", "loc": [3357, 3357], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3356_C4", "vector": [14, 2, 0.8138, 0.0002, 2, 0.72, 0.0, 711, 3, 1, 0, 0, 895, 10, 2], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " m = all(i.matches(ch) for i in self.items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3358_C8", "label": "return", "type": "return", "loc": [3358, 3358], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3356_C4", "vector": [13, 2, 0.8141, 0.0002, 2, 0.72, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return m == self.positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3360_C0", "label": "SetSymDiff", "type": "class", "loc": [3360, 3391], "level": 0, "parent": null, "vector": [3, 0, 0.8183, 0.0078, 0, 0.66, 0.8912, 322, 0, 2, 0, 0, 71, 0, 10], "semantic": {"name": "SetSymDiff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SetSymDiff(SetBase):\n _opcode = {(NOCASE, False): OP.SET_SYM_DIFF, (IGNORECASE, False):\n OP.SET_SYM_DIFF_IGN, (FULLCASE, False): OP.SET_SYM_DIFF, (FULLIGNORECASE,\n False): OP.SET_SYM_DIFF_IGN, (NOCASE, True): OP.SET_SYM_DIFF_REV,\n (IGNORECASE, True): OP.SET_SYM_DIFF_IGN_REV, (FULLCASE, True):\n OP.SET_SYM_DIFF_REV, (FULLIGNORECASE, True): OP.SET_SYM_DIFF_IGN_REV}\n _op_name = \"SET_SYM_DIFF\"\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3361_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [3361, 3365], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3360_C0", "vector": [14, 1, 0.8153, 0.0012, 1, 0.08, 0.0, 52, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = {(NOCASE, False): OP.SET_SYM_DIFF, (IGNORECASE, False):\n OP.SET_SYM_DIFF_IGN, (FULLCASE, False): OP.SET_SYM_DIFF, (FULLIGNORECASE,\n False): OP.SET_SYM_DIFF_IGN, (NOCASE, True): OP.SET_SYM_DIFF_REV,\n (IGNORECASE, True): OP.SET_SYM_DIFF_IGN_REV, (FULLCASE, True):\n OP.SET_SYM_DIFF_REV, (FULLIGNORECASE, True): OP.SET_SYM_DIFF_IGN_REV}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3366_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [3366, 3366], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3360_C0", "vector": [14, 1, 0.816, 0.0002, 1, 0.08, 0.3333, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"SET_SYM_DIFF\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3368_C4", "label": "optimise", "type": "function", "loc": [3368, 3384], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3360_C0", "vector": [2, 1, 0.8184, 0.0041, 1, 0.08, 0.6667, 265, 0, 3, 1, 0, 0, 0, 9], "semantic": {"name": "optimise", "arg_names": ["self", "info", "in_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def optimise(self, info, in_set=False):\n items = []\n for m in self.items:\n m = m.optimise(info, in_set=True)\n if isinstance(m, SetSymDiff) and m.positive:\n # Symmetric difference in symmetric difference.\n items.extend(m.items)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3369_C8", "label": "items =", "type": "assigned_variable", "loc": [3369, 3369], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3368_C4", "vector": [14, 2, 0.8167, 0.0002, 2, 0.0, 0.0, 339, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3370_C8", "label": "for m", "type": "for", "loc": [3370, 3376], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3368_C4", "vector": [6, 2, 0.8177, 0.0017, 2, 0.0, 0.25, 711, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for m in self.items:\n m = m.optimise(info, in_set=True)\n if isinstance(m, SetSymDiff) and m.positive:\n # Symmetric difference in symmetric difference.\n items.extend(m.items)\n else:\n items.append(m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3371_C12", "label": "m = optimise()", "type": "assigned_variable", "loc": [3371, 3371], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3370_C8", "vector": [14, 3, 0.8172, 0.0002, 3, 0.81, 0.0, 711, 3, 2, 0, 0, 265, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "optimise", "annotation": ""}, "snippet": " m = m.optimise(info, in_set=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3372_C12", "label": "if", "type": "if", "loc": [3372, 3376], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3370_C8", "vector": [4, 3, 0.8179, 0.0012, 3, 0.81, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(m, SetSymDiff) and m.positive:\n # Symmetric difference in symmetric difference.\n items.extend(m.items)\n else:\n items.append(m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3374_C16", "label": "extend()", "type": "expression", "loc": [3374, 3374], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3372_C12", "vector": [8, 4, 0.8179, 0.0002, 4, 0.22, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " items.extend(m.items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3376_C16", "label": "append()", "type": "expression", "loc": [3376, 3376], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3372_C12", "vector": [8, 4, 0.8184, 0.0002, 4, 0.22, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " items.append(m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3378_C8", "label": "if", "type": "if", "loc": [3378, 3380], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3368_C4", "vector": [4, 2, 0.8192, 0.0007, 2, 0.0, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(items) == 1:\n return items[0].with_flags(case_flags=self.case_flags,\n zerowidth=self.zerowidth).optimise(info, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3379_C12", "label": "return", "type": "return", "loc": [3379, 3380], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3378_C8", "vector": [13, 3, 0.8193, 0.0005, 3, 0.64, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return items[0].with_flags(case_flags=self.case_flags,\n zerowidth=self.zerowidth).optimise(info, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3382_C8", "label": "self.items = tuple()", "type": "assigned_variable", "loc": [3382, 3382], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3368_C4", "vector": [14, 2, 0.8199, 0.0002, 2, 0.0, 0.75, 11, 3, 1, 0, 0, 259, 10, 1], "semantic": {"name": "self.items", "arg_names": [], "import_names": [], "rhs_call_name": "tuple", "annotation": ""}, "snippet": " self.items = tuple(items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3384_C8", "label": "return", "type": "return", "loc": [3384, 3384], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3368_C4", "vector": [13, 2, 0.8204, 0.0002, 2, 0.0, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._handle_case_folding(info, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3386_C4", "label": "matches", "type": "function", "loc": [3386, 3391], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3360_C0", "vector": [2, 1, 0.8215, 0.0015, 1, 0.08, 1.0, 684, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "matches", "arg_names": ["self", "ch"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def matches(self, ch):\n m = False\n for i in self.items:\n m = m != i.matches(ch)\n\n return m == self.positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3387_C8", "label": "m =", "type": "assigned_variable", "loc": [3387, 3387], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3386_C4", "vector": [14, 2, 0.8211, 0.0002, 2, 0.01, 0.0, 711, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " m = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3388_C8", "label": "for i", "type": "for", "loc": [3388, 3389], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3386_C4", "vector": [6, 2, 0.8215, 0.0005, 2, 0.01, 0.5, 826, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in self.items:\n m = m != i.matches(ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3389_C12", "label": "m =", "type": "assigned_variable", "loc": [3389, 3389], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3388_C8", "vector": [14, 3, 0.8216, 0.0002, 3, 0.58, 0.0, 711, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " m = m != i.matches(ch)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3391_C8", "label": "return", "type": "return", "loc": [3391, 3391], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3386_C4", "vector": [13, 2, 0.8221, 0.0002, 2, 0.01, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return m == self.positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3393_C0", "label": "SetUnion", "type": "class", "loc": [3393, 3457], "level": 0, "parent": null, "vector": [3, 0, 0.8303, 0.0158, 0, 0.66, 0.8964, 489, 0, 3, 0, 0, 71, 0, 24], "semantic": {"name": "SetUnion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SetUnion(SetBase):\n _opcode = {(NOCASE, False): OP.SET_UNION, (IGNORECASE, False):\n OP.SET_UNION_IGN, (FULLCASE, False): OP.SET_UNION, (FULLIGNORECASE,\n False): OP.SET_UNION_IGN, (NOCASE, True): OP.SET_UNION_REV, (IGNORECASE,\n True): OP.SET_UNION_IGN_REV, (FULLCASE, True): OP.SET_UNION_REV,\n (FULLIGNORECASE, True): OP.SET_UNION_IGN_REV}\n _op_name = \"SET_UNION\"\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3394_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [3394, 3398], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3393_C0", "vector": [14, 1, 0.8233, 0.0012, 1, 0.46, 0.0, 52, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = {(NOCASE, False): OP.SET_UNION, (IGNORECASE, False):\n OP.SET_UNION_IGN, (FULLCASE, False): OP.SET_UNION, (FULLIGNORECASE,\n False): OP.SET_UNION_IGN, (NOCASE, True): OP.SET_UNION_REV, (IGNORECASE,\n True): OP.SET_UNION_IGN_REV, (FULLCASE, True): OP.SET_UNION_REV,\n (FULLIGNORECASE, True): OP.SET_UNION_IGN_REV}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3399_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [3399, 3399], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3393_C0", "vector": [14, 1, 0.824, 0.0002, 1, 0.46, 0.25, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"SET_UNION\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3401_C4", "label": "optimise", "type": "function", "loc": [3401, 3419], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3393_C0", "vector": [2, 1, 0.8267, 0.0046, 1, 0.46, 0.5, 265, 0, 3, 1, 0, 0, 0, 9], "semantic": {"name": "optimise", "arg_names": ["self", "info", "in_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def optimise(self, info, in_set=False):\n items = []\n for m in self.items:\n m = m.optimise(info, in_set=True)\n if isinstance(m, SetUnion) and m.positive:\n # Union in union.\n items.extend(m.items)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3402_C8", "label": "items =", "type": "assigned_variable", "loc": [3402, 3402], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3401_C4", "vector": [14, 2, 0.8247, 0.0002, 2, 0.97, 0.0, 339, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3403_C8", "label": "for m", "type": "for", "loc": [3403, 3409], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3401_C4", "vector": [6, 2, 0.8257, 0.0017, 2, 0.97, 0.25, 711, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for m in self.items:\n m = m.optimise(info, in_set=True)\n if isinstance(m, SetUnion) and m.positive:\n # Union in union.\n items.extend(m.items)\n else:\n items.append(m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3404_C12", "label": "m = optimise()", "type": "assigned_variable", "loc": [3404, 3404], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3403_C8", "vector": [14, 3, 0.8252, 0.0002, 3, 0.58, 0.0, 711, 3, 2, 0, 0, 265, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "optimise", "annotation": ""}, "snippet": " m = m.optimise(info, in_set=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3405_C12", "label": "if", "type": "if", "loc": [3405, 3409], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3403_C8", "vector": [4, 3, 0.8259, 0.0012, 3, 0.58, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(m, SetUnion) and m.positive:\n # Union in union.\n items.extend(m.items)\n else:\n items.append(m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3407_C16", "label": "extend()", "type": "expression", "loc": [3407, 3407], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3405_C12", "vector": [8, 4, 0.8259, 0.0002, 4, 0.08, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " items.extend(m.items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3409_C16", "label": "append()", "type": "expression", "loc": [3409, 3409], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3405_C12", "vector": [8, 4, 0.8264, 0.0002, 4, 0.08, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " items.append(m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3411_C8", "label": "if", "type": "if", "loc": [3411, 3415], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3401_C4", "vector": [4, 2, 0.8274, 0.0012, 2, 0.97, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(items) == 1:\n i = items[0]\n return i.with_flags(positive=i.positive == self.positive,\n case_flags=self.case_flags,\n zerowidth=self.zerowidth).optimise(info, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3412_C12", "label": "i =", "type": "assigned_variable", "loc": [3412, 3412], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3411_C8", "vector": [14, 3, 0.8272, 0.0002, 3, 0.58, 0.0, 826, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i = items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3413_C12", "label": "return", "type": "return", "loc": [3413, 3415], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3411_C8", "vector": [13, 3, 0.8276, 0.0007, 3, 0.58, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return i.with_flags(positive=i.positive == self.positive,\n case_flags=self.case_flags,\n zerowidth=self.zerowidth).optimise(info, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3417_C8", "label": "self.items = tuple()", "type": "assigned_variable", "loc": [3417, 3417], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3401_C4", "vector": [14, 2, 0.8284, 0.0002, 2, 0.97, 0.75, 11, 3, 1, 0, 0, 259, 10, 1], "semantic": {"name": "self.items", "arg_names": [], "import_names": [], "rhs_call_name": "tuple", "annotation": ""}, "snippet": " self.items = tuple(items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3419_C8", "label": "return", "type": "return", "loc": [3419, 3419], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3401_C4", "vector": [13, 2, 0.8288, 0.0002, 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._handle_case_folding(info, in_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "label": "_compile", "type": "function", "loc": [3421, 3453], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3393_C0", "vector": [2, 1, 0.8332, 0.008, 1, 0.46, 0.75, 779, 0, 3, 1, 0, 0, 0, 13], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n flags = 0\n if self.positive:\n flags |= POSITIVE_OP\n if self.zerowidth:\n flags |= ZEROWIDTH_OP\n if fuzzy:\n flags |= FUZZY_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3422_C8", "label": "flags =", "type": "assigned_variable", "loc": [3422, 3422], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "vector": [14, 2, 0.8296, 0.0002, 2, 0.91, 0.0, 375, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " flags = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3423_C8", "label": "if", "type": "if", "loc": [3423, 3424], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "vector": [4, 2, 0.8299, 0.0005, 2, 0.91, 0.1, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.positive:\n flags |= POSITIVE_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3425_C8", "label": "if", "type": "if", "loc": [3425, 3426], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "vector": [4, 2, 0.8304, 0.0005, 2, 0.91, 0.2, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.zerowidth:\n flags |= ZEROWIDTH_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3427_C8", "label": "if", "type": "if", "loc": [3427, 3428], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "vector": [4, 2, 0.8309, 0.0005, 2, 0.91, 0.3, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if fuzzy:\n flags |= FUZZY_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3430_C8", "label": "characters, others =", "type": "assigned_variable", "loc": [3430, 3430], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "vector": [14, 2, 0.8315, 0.0002, 2, 0.91, 0.4, 125, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "characters, others", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " characters, others = defaultdict(list), []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3431_C8", "label": "for m", "type": "for", "loc": [3431, 3435], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "vector": [6, 2, 0.8322, 0.0012, 2, 0.91, 0.5, 711, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for m in self.items:\n if isinstance(m, Character):\n characters[m.positive].append(m.value)\n else:\n others.append(m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3432_C12", "label": "if", "type": "if", "loc": [3432, 3435], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3431_C8", "vector": [4, 3, 0.8324, 0.001, 3, 0.93, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(m, Character):\n characters[m.positive].append(m.value)\n else:\n others.append(m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3433_C16", "label": "append()", "type": "expression", "loc": [3433, 3433], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3432_C12", "vector": [8, 4, 0.8322, 0.0002, 4, 0.76, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " characters[m.positive].append(m.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3435_C16", "label": "append()", "type": "expression", "loc": [3435, 3435], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3432_C12", "vector": [8, 4, 0.8327, 0.0002, 4, 0.76, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " others.append(m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3437_C8", "label": "code =", "type": "assigned_variable", "loc": [3437, 3437], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "vector": [14, 2, 0.8332, 0.0002, 2, 0.91, 0.6, 44, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " code = [(self._opcode[self.case_flags, reverse], flags)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3439_C8", "label": "for positive, values", "type": "for", "loc": [3439, 3446], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "vector": [6, 2, 0.8345, 0.0019, 2, 0.91, 0.7, 314, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "positive, values", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for positive, values in characters.items():\n flags = 0\n if positive:\n flags |= POSITIVE_OP\n if len(values) == 1:\n code.append((OP.CHARACTER, flags, values[0]))\n else:\n code.append((OP.STRING, flags, len(values)) + tuple(values))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3440_C12", "label": "flags =", "type": "assigned_variable", "loc": [3440, 3440], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3439_C8", "vector": [14, 3, 0.8339, 0.0002, 3, 0.4, 0.0, 375, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " flags = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3441_C12", "label": "if", "type": "if", "loc": [3441, 3442], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3439_C8", "vector": [4, 3, 0.8343, 0.0005, 3, 0.4, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if positive:\n flags |= POSITIVE_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3443_C12", "label": "if", "type": "if", "loc": [3443, 3446], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3439_C8", "vector": [4, 3, 0.835, 0.001, 3, 0.4, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(values) == 1:\n code.append((OP.CHARACTER, flags, values[0]))\n else:\n code.append((OP.STRING, flags, len(values)) + tuple(values))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3444_C16", "label": "append()", "type": "expression", "loc": [3444, 3444], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3443_C12", "vector": [8, 4, 0.8349, 0.0002, 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": " code.append((OP.CHARACTER, flags, values[0]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3446_C16", "label": "append()", "type": "expression", "loc": [3446, 3446], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3443_C12", "vector": [8, 4, 0.8354, 0.0002, 4, 0.64, 1.0, 243, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " code.append((OP.STRING, flags, len(values)) + tuple(values))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3448_C8", "label": "for m", "type": "for", "loc": [3448, 3449], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "vector": [6, 2, 0.836, 0.0005, 2, 0.91, 0.8, 711, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for m in others:\n code.extend(m.compile())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3449_C12", "label": "extend()", "type": "expression", "loc": [3449, 3449], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3448_C8", "vector": [8, 3, 0.8361, 0.0002, 3, 0.03, 0.0, 660, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " code.extend(m.compile())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3451_C8", "label": "append()", "type": "expression", "loc": [3451, 3451], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "vector": [8, 2, 0.8366, 0.0002, 2, 0.91, 0.9, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " code.append((OP.END, ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3453_C8", "label": "return", "type": "return", "loc": [3453, 3453], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "vector": [13, 2, 0.8371, 0.0002, 2, 0.91, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3455_C4", "label": "matches", "type": "function", "loc": [3455, 3457], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3393_C0", "vector": [2, 1, 0.8378, 0.0007, 1, 0.46, 1.0, 684, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "matches", "arg_names": ["self", "ch"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def matches(self, ch):\n m = any(i.matches(ch) for i in self.items)\n return m == self.positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3456_C8", "label": "m = any()", "type": "assigned_variable", "loc": [3456, 3456], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3455_C4", "vector": [14, 2, 0.8378, 0.0002, 2, 0.32, 0.0, 711, 3, 1, 0, 0, 277, 10, 2], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "any", "annotation": ""}, "snippet": " m = any(i.matches(ch) for i in self.items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3457_C8", "label": "return", "type": "return", "loc": [3457, 3457], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3455_C4", "vector": [13, 2, 0.8381, 0.0002, 2, 0.32, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return m == self.positive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3459_C0", "label": "StartOfLine", "type": "class", "loc": [3459, 3461], "level": 0, "parent": null, "vector": [3, 0, 0.8388, 0.0007, 0, 0.66, 0.9016, 819, 0, 0, 0, 0, 752, 0, 0], "semantic": {"name": "StartOfLine", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class StartOfLine(ZeroWidthBase):\n _opcode = OP.START_OF_LINE\n _op_name = \"START_OF_LINE\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3460_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [3460, 3460], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3459_C0", "vector": [14, 1, 0.8388, 0.0002, 1, 0.61, 0.0, 52, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = OP.START_OF_LINE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3461_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [3461, 3461], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3459_C0", "vector": [14, 1, 0.839, 0.0002, 1, 0.61, 1.0, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"START_OF_LINE\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3463_C0", "label": "StartOfLineU", "type": "class", "loc": [3463, 3465], "level": 0, "parent": null, "vector": [3, 0, 0.8398, 0.0007, 0, 0.66, 0.9067, 153, 0, 0, 0, 0, 819, 0, 0], "semantic": {"name": "StartOfLineU", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class StartOfLineU(StartOfLine):\n _opcode = OP.START_OF_LINE_U\n _op_name = \"START_OF_LINE_U\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3464_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [3464, 3464], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3463_C0", "vector": [14, 1, 0.8398, 0.0002, 1, 0.61, 0.0, 52, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = OP.START_OF_LINE_U"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3465_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [3465, 3465], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3463_C0", "vector": [14, 1, 0.84, 0.0002, 1, 0.61, 1.0, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"START_OF_LINE_U\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3467_C0", "label": "StartOfString", "type": "class", "loc": [3467, 3469], "level": 0, "parent": null, "vector": [3, 0, 0.8407, 0.0007, 0, 0.66, 0.9119, 656, 0, 0, 0, 0, 752, 0, 0], "semantic": {"name": "StartOfString", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class StartOfString(ZeroWidthBase):\n _opcode = OP.START_OF_STRING\n _op_name = \"START_OF_STRING\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3468_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [3468, 3468], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3467_C0", "vector": [14, 1, 0.8407, 0.0002, 1, 0.14, 0.0, 52, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = OP.START_OF_STRING"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3469_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [3469, 3469], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3467_C0", "vector": [14, 1, 0.841, 0.0002, 1, 0.14, 1.0, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"START_OF_STRING\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3471_C0", "label": "StartOfWord", "type": "class", "loc": [3471, 3473], "level": 0, "parent": null, "vector": [3, 0, 0.8417, 0.0007, 0, 0.66, 0.9171, 743, 0, 0, 0, 0, 752, 0, 0], "semantic": {"name": "StartOfWord", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class StartOfWord(ZeroWidthBase):\n _opcode = OP.START_OF_WORD\n _op_name = \"START_OF_WORD\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3472_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [3472, 3472], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3471_C0", "vector": [14, 1, 0.8417, 0.0002, 1, 0.19, 0.0, 52, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = OP.START_OF_WORD"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3473_C4", "label": "_op_name =", "type": "assigned_variable", "loc": [3473, 3473], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3471_C0", "vector": [14, 1, 0.8419, 0.0002, 1, 0.19, 1.0, 538, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_op_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _op_name = \"START_OF_WORD\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3475_C0", "label": "String", "type": "class", "loc": [3475, 3528], "level": 0, "parent": null, "vector": [3, 0, 0.8488, 0.0131, 0, 0.66, 0.9223, 214, 0, 7, 0, 0, 852, 0, 16], "semantic": {"name": "String", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class String(RegexBase):\n _opcode = {(NOCASE, False): OP.STRING, (IGNORECASE, False): OP.STRING_IGN,\n (FULLCASE, False): OP.STRING, (FULLIGNORECASE, False): OP.STRING_FLD,\n (NOCASE, True): OP.STRING_REV, (IGNORECASE, True): OP.STRING_IGN_REV,\n (FULLCASE, True): OP.STRING_REV, (FULLIGNORECASE, True):\n OP.STRING_FLD_REV}\n\n def __init__(self, characters, case_flags=NOCASE):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3476_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [3476, 3480], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3475_C0", "vector": [14, 1, 0.8432, 0.0012, 1, 0.93, 0.0, 52, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = {(NOCASE, False): OP.STRING, (IGNORECASE, False): OP.STRING_IGN,\n (FULLCASE, False): OP.STRING, (FULLIGNORECASE, False): OP.STRING_FLD,\n (NOCASE, True): OP.STRING_REV, (IGNORECASE, True): OP.STRING_IGN_REV,\n (FULLCASE, True): OP.STRING_REV, (FULLIGNORECASE, True):\n OP.STRING_FLD_REV}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3482_C4", "label": "__init__", "type": "function", "loc": [3482, 3497], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3475_C0", "vector": [2, 1, 0.8459, 0.0039, 1, 0.93, 0.1429, 555, 0, 3, 0, 0, 0, 0, 6], "semantic": {"name": "__init__", "arg_names": ["self", "characters", "case_flags"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, characters, case_flags=NOCASE):\n self.characters = tuple(characters)\n self.case_flags = case_flags\n\n if (self.case_flags & FULLIGNORECASE) == FULLIGNORECASE:\n folded_characters = []\n for char in self.characters:\n folded = _regex.fold_case(FULL_CASE_FOLDING, chr(char))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3483_C8", "label": "self.characters = tuple()", "type": "assigned_variable", "loc": [3483, 3483], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3482_C4", "vector": [14, 2, 0.8444, 0.0002, 2, 0.79, 0.0, 858, 3, 1, 0, 0, 259, 10, 1], "semantic": {"name": "self.characters", "arg_names": [], "import_names": [], "rhs_call_name": "tuple", "annotation": ""}, "snippet": " self.characters = tuple(characters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3484_C8", "label": "self.case_flags =", "type": "assigned_variable", "loc": [3484, 3484], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3482_C4", "vector": [14, 2, 0.8446, 0.0002, 2, 0.79, 0.2, 56, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.case_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.case_flags = case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3486_C8", "label": "if", "type": "if", "loc": [3486, 3492], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3482_C4", "vector": [4, 2, 0.8458, 0.0017, 2, 0.79, 0.4, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (self.case_flags & FULLIGNORECASE) == FULLIGNORECASE:\n folded_characters = []\n for char in self.characters:\n folded = _regex.fold_case(FULL_CASE_FOLDING, chr(char))\n folded_characters.extend(ord(c) for c in folded)\n else:\n folded_characters = self.characters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3487_C12", "label": "folded_characters =", "type": "assigned_variable", "loc": [3487, 3487], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3486_C8", "vector": [14, 3, 0.8453, 0.0002, 3, 0.69, 0.0, 87, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "folded_characters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " folded_characters = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3488_C12", "label": "for char", "type": "for", "loc": [3488, 3490], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3486_C8", "vector": [6, 3, 0.8458, 0.0007, 3, 0.69, 0.5, 272, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "char", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for char in self.characters:\n folded = _regex.fold_case(FULL_CASE_FOLDING, chr(char))\n folded_characters.extend(ord(c) for c in folded)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3489_C16", "label": "folded = fold_case()", "type": "assigned_variable", "loc": [3489, 3489], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3488_C12", "vector": [14, 4, 0.8458, 0.0002, 4, 0.28, 0.0, 68, 3, 2, 0, 0, 184, 10, 2], "semantic": {"name": "folded", "arg_names": [], "import_names": [], "rhs_call_name": "fold_case", "annotation": ""}, "snippet": " folded = _regex.fold_case(FULL_CASE_FOLDING, chr(char))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3490_C16", "label": "extend()", "type": "expression", "loc": [3490, 3490], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3488_C12", "vector": [8, 4, 0.8461, 0.0002, 4, 0.28, 1.0, 660, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " folded_characters.extend(ord(c) for c in folded)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3492_C12", "label": "folded_characters =", "type": "assigned_variable", "loc": [3492, 3492], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3486_C8", "vector": [14, 3, 0.8465, 0.0002, 3, 0.69, 1.0, 87, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "folded_characters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " folded_characters = self.characters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3494_C8", "label": "self.folded_characters = tuple()", "type": "assigned_variable", "loc": [3494, 3494], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3482_C4", "vector": [14, 2, 0.847, 0.0002, 2, 0.79, 0.6, 249, 3, 1, 0, 0, 259, 10, 1], "semantic": {"name": "self.folded_characters", "arg_names": [], "import_names": [], "rhs_call_name": "tuple", "annotation": ""}, "snippet": " self.folded_characters = tuple(folded_characters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3495_C8", "label": "self.required =", "type": "assigned_variable", "loc": [3495, 3495], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3482_C4", "vector": [14, 2, 0.8473, 0.0002, 2, 0.79, 0.8, 770, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.required", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.required = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3497_C8", "label": "self._key =", "type": "assigned_variable", "loc": [3497, 3497], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3482_C4", "vector": [14, 2, 0.8478, 0.0002, 2, 0.79, 1.0, 449, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "self._key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._key = self.__class__, self.characters, self.case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3499_C4", "label": "get_firstset", "type": "function", "loc": [3499, 3505], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3475_C0", "vector": [2, 1, 0.849, 0.0017, 1, 0.93, 0.2857, 638, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "get_firstset", "arg_names": ["self", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_firstset(self, reverse):\n if reverse:\n pos = -1\n else:\n pos = 0\n return set([Character(self.characters[pos],\n case_flags=self.case_flags)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3500_C8", "label": "if", "type": "if", "loc": [3500, 3503], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3499_C4", "vector": [4, 2, 0.8488, 0.001, 2, 0.36, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if reverse:\n pos = -1\n else:\n pos = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3501_C12", "label": "pos =", "type": "assigned_variable", "loc": [3501, 3501], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3500_C8", "vector": [14, 3, 0.8487, 0.0002, 3, 0.01, 0.0, 627, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3503_C12", "label": "pos =", "type": "assigned_variable", "loc": [3503, 3503], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3500_C8", "vector": [14, 3, 0.8492, 0.0002, 3, 0.01, 1.0, 627, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3504_C8", "label": "return", "type": "return", "loc": [3504, 3505], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3499_C4", "vector": [13, 2, 0.8496, 0.0005, 2, 0.36, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return set([Character(self.characters[pos],\n case_flags=self.case_flags)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3507_C4", "label": "has_simple_start", "type": "function", "loc": [3507, 3508], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3475_C0", "vector": [2, 1, 0.8503, 0.0005, 1, 0.93, 0.4286, 317, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "has_simple_start", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def has_simple_start(self):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3508_C8", "label": "return", "type": "return", "loc": [3508, 3508], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3507_C4", "vector": [13, 2, 0.8504, 0.0002, 2, 0.94, 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_1389:FunctionDef_L3510_C4", "label": "_compile", "type": "function", "loc": [3510, 3517], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3475_C0", "vector": [2, 1, 0.8518, 0.0019, 1, 0.93, 0.5714, 779, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n flags = 0\n if fuzzy:\n flags |= FUZZY_OP\n if self.required:\n flags |= REQUIRED_OP\n return [(self._opcode[self.case_flags, reverse], flags,\n len(self.folded_characters)) + self.folded_characters]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3511_C8", "label": "flags =", "type": "assigned_variable", "loc": [3511, 3511], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3510_C4", "vector": [14, 2, 0.8512, 0.0002, 2, 0.41, 0.0, 375, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " flags = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3512_C8", "label": "if", "type": "if", "loc": [3512, 3513], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3510_C4", "vector": [4, 2, 0.8515, 0.0005, 2, 0.41, 0.3333, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if fuzzy:\n flags |= FUZZY_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3514_C8", "label": "if", "type": "if", "loc": [3514, 3515], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3510_C4", "vector": [4, 2, 0.852, 0.0005, 2, 0.41, 0.6667, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.required:\n flags |= REQUIRED_OP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3516_C8", "label": "return", "type": "return", "loc": [3516, 3517], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3510_C4", "vector": [13, 2, 0.8525, 0.0005, 2, 0.41, 1.0, 0, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [(self._opcode[self.case_flags, reverse], flags,\n len(self.folded_characters)) + self.folded_characters]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3519_C4", "label": "_dump", "type": "function", "loc": [3519, 3522], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3475_C0", "vector": [2, 1, 0.8535, 0.001, 1, 0.93, 0.7143, 656, 0, 3, 0, 0, 0, 0, 6], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n display = ascii(\"\".join(chr(c) for c in self.characters)).lstrip(\"bu\")\n print(\"{}STRING {}{}\".format(INDENT * indent, display,\n CASE_TEXT[self.case_flags]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3520_C8", "label": "display = lstrip()", "type": "assigned_variable", "loc": [3520, 3520], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3519_C4", "vector": [14, 2, 0.8533, 0.0002, 2, 0.9, 0.0, 669, 3, 1, 0, 0, 313, 10, 4], "semantic": {"name": "display", "arg_names": [], "import_names": [], "rhs_call_name": "lstrip", "annotation": ""}, "snippet": " display = ascii(\"\".join(chr(c) for c in self.characters)).lstrip(\"bu\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3521_C8", "label": "print()", "type": "expression", "loc": [3521, 3522], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3519_C4", "vector": [8, 2, 0.8537, 0.0005, 2, 0.9, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}STRING {}{}\".format(INDENT * indent, display,\n CASE_TEXT[self.case_flags]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3524_C4", "label": "max_width", "type": "function", "loc": [3524, 3525], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3475_C0", "vector": [2, 1, 0.8544, 0.0005, 1, 0.93, 0.8571, 0, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "max_width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_width(self):\n return len(self.folded_characters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3525_C8", "label": "return", "type": "return", "loc": [3525, 3525], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3524_C4", "vector": [13, 2, 0.8545, 0.0002, 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 len(self.folded_characters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3527_C4", "label": "get_required_string", "type": "function", "loc": [3527, 3528], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3475_C0", "vector": [2, 1, 0.8552, 0.0005, 1, 0.93, 1.0, 720, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "get_required_string", "arg_names": ["self", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_required_string(self, reverse):\n return 0, self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3528_C8", "label": "return", "type": "return", "loc": [3528, 3528], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3527_C4", "vector": [13, 2, 0.8553, 0.0002, 2, 0.5, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0, self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3530_C0", "label": "Literal", "type": "class", "loc": [3530, 3535], "level": 0, "parent": null, "vector": [3, 0, 0.8564, 0.0015, 0, 0.66, 0.9275, 566, 0, 1, 0, 0, 214, 0, 5], "semantic": {"name": "Literal", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Literal(String):\n def _dump(self, indent, reverse):\n for c in self.characters:\n display = ascii(chr(c)).lstrip(\"bu\")\n print(\"{}CHARACTER MATCH {}{}\".format(INDENT * indent, display,\n CASE_TEXT[self.case_flags]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3531_C4", "label": "_dump", "type": "function", "loc": [3531, 3535], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3530_C0", "vector": [2, 1, 0.8565, 0.0012, 1, 0.01, 0.0, 656, 0, 3, 0, 0, 0, 0, 5], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n for c in self.characters:\n display = ascii(chr(c)).lstrip(\"bu\")\n print(\"{}CHARACTER MATCH {}{}\".format(INDENT * indent, display,\n CASE_TEXT[self.case_flags]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3532_C8", "label": "for c", "type": "for", "loc": [3532, 3535], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3531_C4", "vector": [6, 2, 0.8566, 0.001, 2, 0.93, 0.0, 411, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in self.characters:\n display = ascii(chr(c)).lstrip(\"bu\")\n print(\"{}CHARACTER MATCH {}{}\".format(INDENT * indent, display,\n CASE_TEXT[self.case_flags]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3533_C12", "label": "display = lstrip()", "type": "assigned_variable", "loc": [3533, 3533], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3532_C8", "vector": [14, 3, 0.8565, 0.0002, 3, 0.14, 0.0, 669, 3, 1, 0, 0, 313, 10, 3], "semantic": {"name": "display", "arg_names": [], "import_names": [], "rhs_call_name": "lstrip", "annotation": ""}, "snippet": " display = ascii(chr(c)).lstrip(\"bu\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3534_C12", "label": "print()", "type": "expression", "loc": [3534, 3535], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3532_C8", "vector": [8, 3, 0.8568, 0.0005, 3, 0.14, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}CHARACTER MATCH {}{}\".format(INDENT * indent, display,\n CASE_TEXT[self.case_flags]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3537_C0", "label": "StringSet", "type": "class", "loc": [3537, 3631], "level": 0, "parent": null, "vector": [3, 0, 0.8688, 0.023, 0, 0.66, 0.9326, 798, 0, 6, 0, 0, 852, 0, 36], "semantic": {"name": "StringSet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class StringSet(RegexBase):\n _opcode = {(NOCASE, False): OP.STRING_SET, (IGNORECASE, False):\n OP.STRING_SET_IGN, (FULLCASE, False): OP.STRING_SET, (FULLIGNORECASE,\n False): OP.STRING_SET_FLD, (NOCASE, True): OP.STRING_SET_REV,\n (IGNORECASE, True): OP.STRING_SET_IGN_REV, (FULLCASE, True):\n OP.STRING_SET_REV, (FULLIGNORECASE, True): OP.STRING_SET_FLD_REV}\n\n def __init__(self, info, name, case_flags=NOCASE):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3538_C4", "label": "_opcode =", "type": "assigned_variable", "loc": [3538, 3542], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3537_C0", "vector": [14, 1, 0.8582, 0.0012, 1, 0.32, 0.0, 52, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_opcode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _opcode = {(NOCASE, False): OP.STRING_SET, (IGNORECASE, False):\n OP.STRING_SET_IGN, (FULLCASE, False): OP.STRING_SET, (FULLIGNORECASE,\n False): OP.STRING_SET_FLD, (NOCASE, True): OP.STRING_SET_REV,\n (IGNORECASE, True): OP.STRING_SET_IGN_REV, (FULLCASE, True):\n OP.STRING_SET_REV, (FULLIGNORECASE, True): OP.STRING_SET_FLD_REV}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3544_C4", "label": "__init__", "type": "function", "loc": [3544, 3553], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3537_C0", "vector": [2, 1, 0.8602, 0.0024, 1, 0.32, 0.1667, 555, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "info", "name", "case_flags"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, info, name, case_flags=NOCASE):\n self.info = info\n self.name = name\n self.case_flags = case_flags\n\n self._key = self.__class__, self.name, self.case_flags\n\n self.set_key = (name, self.case_flags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3545_C8", "label": "self.info =", "type": "assigned_variable", "loc": [3545, 3545], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3544_C4", "vector": [14, 2, 0.8594, 0.0002, 2, 0.39, 0.0, 264, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.info = info"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3546_C8", "label": "self.name =", "type": "assigned_variable", "loc": [3546, 3546], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3544_C4", "vector": [14, 2, 0.8596, 0.0002, 2, 0.39, 0.2, 689, 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_1389:Assign_L3547_C8", "label": "self.case_flags =", "type": "assigned_variable", "loc": [3547, 3547], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3544_C4", "vector": [14, 2, 0.8599, 0.0002, 2, 0.39, 0.4, 56, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.case_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.case_flags = case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3549_C8", "label": "self._key =", "type": "assigned_variable", "loc": [3549, 3549], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3544_C4", "vector": [14, 2, 0.8604, 0.0002, 2, 0.39, 0.6, 449, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "self._key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._key = self.__class__, self.name, self.case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3551_C8", "label": "self.set_key =", "type": "assigned_variable", "loc": [3551, 3551], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3544_C4", "vector": [14, 2, 0.8608, 0.0002, 2, 0.39, 0.8, 83, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "self.set_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.set_key = (name, self.case_flags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3552_C8", "label": "if", "type": "if", "loc": [3552, 3553], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3544_C4", "vector": [4, 2, 0.8612, 0.0005, 2, 0.39, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.set_key not in info.named_lists_used:\n info.named_lists_used[self.set_key] = len(info.named_lists_used)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3553_C12", "label": " = len()", "type": "assigned_variable", "loc": [3553, 3553], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3552_C8", "vector": [14, 3, 0.8613, 0.0002, 3, 0.89, 0.0, 0, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " info.named_lists_used[self.set_key] = len(info.named_lists_used)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3555_C4", "label": "_compile", "type": "function", "loc": [3555, 3589], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3537_C0", "vector": [2, 1, 0.8659, 0.0085, 1, 0.32, 0.3333, 779, 0, 3, 1, 0, 0, 0, 16], "semantic": {"name": "_compile", "arg_names": ["self", "reverse", "fuzzy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _compile(self, reverse, fuzzy):\n index = self.info.named_lists_used[self.set_key]\n items = self.info.kwargs[self.name]\n\n case_flags = self.case_flags\n\n if not items:\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3556_C8", "label": "index =", "type": "assigned_variable", "loc": [3556, 3556], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3555_C4", "vector": [14, 2, 0.8621, 0.0002, 2, 0.5, 0.0, 780, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " index = self.info.named_lists_used[self.set_key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3557_C8", "label": "items =", "type": "assigned_variable", "loc": [3557, 3557], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3555_C4", "vector": [14, 2, 0.8623, 0.0002, 2, 0.5, 0.1667, 339, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = self.info.kwargs[self.name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3559_C8", "label": "case_flags =", "type": "assigned_variable", "loc": [3559, 3559], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3555_C4", "vector": [14, 2, 0.8628, 0.0002, 2, 0.5, 0.3333, 912, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "case_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " case_flags = self.case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3561_C8", "label": "if", "type": "if", "loc": [3561, 3562], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3555_C4", "vector": [4, 2, 0.8634, 0.0005, 2, 0.5, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not items:\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3562_C12", "label": "return", "type": "return", "loc": [3562, 3562], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3561_C8", "vector": [13, 3, 0.8635, 0.0002, 3, 0.26, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3564_C8", "label": "encoding =", "type": "assigned_variable", "loc": [3564, 3564], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3555_C4", "vector": [14, 2, 0.864, 0.0002, 2, 0.5, 0.6667, 325, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " encoding = self.info.flags & _ALL_ENCODINGS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3565_C8", "label": "fold_flags =", "type": "assigned_variable", "loc": [3565, 3565], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3555_C4", "vector": [14, 2, 0.8642, 0.0002, 2, 0.5, 0.8333, 69, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fold_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fold_flags = encoding | case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "label": "if", "type": "if", "loc": [3567, 3589], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3555_C4", "vector": [4, 2, 0.8674, 0.0056, 2, 0.5, 1.0, 0, 2, 0, 0, 0, 0, 0, 16], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if fuzzy:\n choices = [self._folded(fold_flags, i) for i in items]\n\n # Sort from longest to shortest.\n choices.sort(key=lambda s: (-len(s), s))\n\n branches = []\n for string in choices:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3568_C12", "label": "choices =", "type": "assigned_variable", "loc": [3568, 3568], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "vector": [14, 3, 0.865, 0.0002, 3, 0.54, 0.0, 405, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "choices", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " choices = [self._folded(fold_flags, i) for i in items]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3571_C12", "label": "sort()", "type": "expression", "loc": [3571, 3571], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "vector": [8, 3, 0.8657, 0.0002, 3, 0.54, 0.1111, 489, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " choices.sort(key=lambda s: (-len(s), s))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3573_C12", "label": "branches =", "type": "assigned_variable", "loc": [3573, 3573], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "vector": [14, 3, 0.8662, 0.0002, 3, 0.54, 0.2222, 286, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "branches", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " branches = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3574_C12", "label": "for string", "type": "for", "loc": [3574, 3576], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "vector": [6, 3, 0.8667, 0.0007, 3, 0.54, 0.3333, 890, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "string", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for string in choices:\n branches.append(Sequence([Character(c, case_flags=case_flags)\n for c in string]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3575_C16", "label": "append()", "type": "expression", "loc": [3575, 3576], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3574_C12", "vector": [8, 4, 0.8668, 0.0005, 4, 0.64, 0.0, 243, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " branches.append(Sequence([Character(c, case_flags=case_flags)\n for c in string]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3578_C12", "label": "if", "type": "if", "loc": [3578, 3581], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "vector": [4, 3, 0.8678, 0.001, 3, 0.54, 0.4444, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(branches) > 1:\n branch = Branch(branches)\n else:\n branch = branches[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3579_C16", "label": "branch = Branch()", "type": "assigned_variable", "loc": [3579, 3579], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3578_C12", "vector": [14, 4, 0.8676, 0.0002, 4, 0.26, 0.0, 757, 3, 1, 0, 0, 855, 10, 1], "semantic": {"name": "branch", "arg_names": [], "import_names": [], "rhs_call_name": "Branch", "annotation": ""}, "snippet": " branch = Branch(branches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3581_C16", "label": "branch =", "type": "assigned_variable", "loc": [3581, 3581], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3578_C12", "vector": [14, 4, 0.8681, 0.0002, 4, 0.26, 1.0, 757, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "branch", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " branch = branches[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3582_C12", "label": "branch = pack_characters()", "type": "assigned_variable", "loc": [3582, 3582], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "vector": [14, 3, 0.8684, 0.0002, 3, 0.54, 0.5556, 757, 3, 1, 0, 0, 434, 10, 2], "semantic": {"name": "branch", "arg_names": [], "import_names": [], "rhs_call_name": "pack_characters", "annotation": ""}, "snippet": " branch = branch.optimise(self.info).pack_characters(self.info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3584_C12", "label": "return", "type": "return", "loc": [3584, 3584], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "vector": [13, 3, 0.8688, 0.0002, 3, 0.54, 0.6667, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return branch.compile(reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3586_C12", "label": "min_len = min()", "type": "assigned_variable", "loc": [3586, 3586], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "vector": [14, 3, 0.8693, 0.0002, 3, 0.54, 0.7778, 487, 3, 1, 0, 0, 867, 10, 2], "semantic": {"name": "min_len", "arg_names": [], "import_names": [], "rhs_call_name": "min", "annotation": ""}, "snippet": " min_len = min(len(i) for i in items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3587_C12", "label": "max_len = max()", "type": "assigned_variable", "loc": [3587, 3587], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "vector": [14, 3, 0.8696, 0.0002, 3, 0.54, 0.8889, 851, 3, 1, 0, 0, 442, 10, 3], "semantic": {"name": "max_len", "arg_names": [], "import_names": [], "rhs_call_name": "max", "annotation": ""}, "snippet": " max_len = max(len(self._folded(fold_flags, i)) for i in items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3588_C12", "label": "return", "type": "return", "loc": [3588, 3589], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "vector": [13, 3, 0.8699, 0.0005, 3, 0.54, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [(self._opcode[case_flags, reverse], index, min_len,\n max_len)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3591_C4", "label": "_dump", "type": "function", "loc": [3591, 3593], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3537_C0", "vector": [2, 1, 0.8708, 0.0007, 1, 0.32, 0.5, 656, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "_dump", "arg_names": ["self", "indent", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dump(self, indent, reverse):\n print(\"{}STRING_SET {}{}\".format(INDENT * indent, self.name,\n CASE_TEXT[self.case_flags]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3592_C8", "label": "print()", "type": "expression", "loc": [3592, 3593], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3591_C4", "vector": [8, 2, 0.8709, 0.0005, 2, 0.49, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"{}STRING_SET {}{}\".format(INDENT * indent, self.name,\n CASE_TEXT[self.case_flags]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3595_C4", "label": "_folded", "type": "function", "loc": [3595, 3599], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3537_C0", "vector": [2, 1, 0.872, 0.0012, 1, 0.32, 0.6667, 930, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "_folded", "arg_names": ["self", "fold_flags", "item"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _folded(self, fold_flags, item):\n if isinstance(item, str):\n return [ord(c) for c in _regex.fold_case(fold_flags, item)]\n else:\n return list(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3596_C8", "label": "if", "type": "if", "loc": [3596, 3599], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3595_C4", "vector": [4, 2, 0.8721, 0.001, 2, 0.39, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(item, str):\n return [ord(c) for c in _regex.fold_case(fold_flags, item)]\n else:\n return list(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3597_C12", "label": "return", "type": "return", "loc": [3597, 3597], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3596_C8", "vector": [13, 3, 0.872, 0.0002, 3, 0.8, 0.0, 0, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [ord(c) for c in _regex.fold_case(fold_flags, item)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3599_C12", "label": "return", "type": "return", "loc": [3599, 3599], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3596_C8", "vector": [13, 3, 0.8725, 0.0002, 3, 0.8, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return list(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3601_C4", "label": "_flatten", "type": "function", "loc": [3601, 3620], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3537_C0", "vector": [2, 1, 0.8753, 0.0048, 1, 0.32, 0.8333, 916, 0, 2, 0, 0, 0, 0, 8], "semantic": {"name": "_flatten", "arg_names": ["self", "s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _flatten(self, s):\n # Flattens the branches.\n if isinstance(s, Branch):\n for b in s.branches:\n self._flatten(b)\n elif isinstance(s, Sequence) and s.items:\n seq = s.items\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3603_C8", "label": "if", "type": "if", "loc": [3603, 3620], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3601_C4", "vector": [4, 2, 0.8755, 0.0044, 2, 0.81, 0.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(s, Branch):\n for b in s.branches:\n self._flatten(b)\n elif isinstance(s, Sequence) and s.items:\n seq = s.items\n\n while isinstance(seq[-1], Sequence):\n seq[-1 : ] = seq[-1].items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3604_C12", "label": "for b", "type": "for", "loc": [3604, 3605], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3603_C8", "vector": [6, 3, 0.8738, 0.0005, 3, 0.01, 0.0, 756, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for b in s.branches:\n self._flatten(b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3605_C16", "label": "_flatten()", "type": "expression", "loc": [3605, 3605], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3604_C12", "vector": [8, 4, 0.8739, 0.0002, 4, 0.79, 0.0, 916, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_flatten", "arg_names": [], "import_names": [], "rhs_call_name": "_flatten", "annotation": ""}, "snippet": " self._flatten(b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3606_C8", "label": "if", "type": "if", "loc": [3606, 3620], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3603_C8", "vector": [4, 3, 0.8759, 0.0036, 3, 0.01, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(s, Sequence) and s.items:\n seq = s.items\n\n while isinstance(seq[-1], Sequence):\n seq[-1 : ] = seq[-1].items\n\n n = 0\n while n < len(seq) and isinstance(seq[n], Character):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3607_C12", "label": "seq =", "type": "assigned_variable", "loc": [3607, 3607], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3606_C8", "vector": [14, 4, 0.8744, 0.0002, 4, 0.82, 0.0, 609, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "seq", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " seq = s.items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3609_C12", "label": "while", "type": "while", "loc": [3609, 3610], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3606_C8", "vector": [5, 4, 0.875, 0.0005, 4, 0.82, 0.2, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while isinstance(seq[-1], Sequence):\n seq[-1 : ] = seq[-1].items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3610_C16", "label": "assign", "type": "assigned_variable", "loc": [3610, 3610], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3609_C12", "vector": [14, 5, 0.8752, 0.0002, 5, 0.1, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " seq[-1 : ] = seq[-1].items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3612_C12", "label": "n =", "type": "assigned_variable", "loc": [3612, 3612], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3606_C8", "vector": [14, 4, 0.8756, 0.0002, 4, 0.82, 0.4, 773, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "n", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " n = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3613_C12", "label": "while", "type": "while", "loc": [3613, 3614], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3606_C8", "vector": [5, 4, 0.876, 0.0005, 4, 0.82, 0.6, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while n < len(seq) and isinstance(seq[n], Character):\n n += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3616_C12", "label": "if", "type": "if", "loc": [3616, 3618], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3606_C8", "vector": [4, 4, 0.8768, 0.0007, 4, 0.82, 0.8, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if n > 1:\n seq[ : n] = [String([c.value for c in seq[ : n]],\n case_flags=self.case_flags)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3617_C16", "label": "assign", "type": "assigned_variable", "loc": [3617, 3618], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3616_C12", "vector": [14, 5, 0.877, 0.0005, 5, 0.55, 0.0, 0, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " seq[ : n] = [String([c.value for c in seq[ : n]],\n case_flags=self.case_flags)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3620_C12", "label": "_flatten()", "type": "expression", "loc": [3620, 3620], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3606_C8", "vector": [8, 4, 0.8776, 0.0002, 4, 0.82, 1.0, 916, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_flatten", "arg_names": [], "import_names": [], "rhs_call_name": "_flatten", "annotation": ""}, "snippet": " self._flatten(seq[-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3622_C4", "label": "max_width", "type": "function", "loc": [3622, 3631], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3537_C0", "vector": [2, 1, 0.8792, 0.0024, 1, 0.32, 1.0, 0, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "max_width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_width(self):\n if not self.info.kwargs[self.name]:\n return 0\n\n if self.case_flags & IGNORECASE:\n fold_flags = (self.info.flags & _ALL_ENCODINGS) | self.case_flags\n return max(len(_regex.fold_case(fold_flags, i)) for i in\n self.info.kwargs[self.name])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3623_C8", "label": "if", "type": "if", "loc": [3623, 3624], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3622_C4", "vector": [4, 2, 0.8784, 0.0005, 2, 0.37, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.info.kwargs[self.name]:\n return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3624_C12", "label": "return", "type": "return", "loc": [3624, 3624], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3623_C8", "vector": [13, 3, 0.8785, 0.0002, 3, 0.15, 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_1389:If_L3626_C8", "label": "if", "type": "if", "loc": [3626, 3631], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3622_C4", "vector": [4, 2, 0.8796, 0.0015, 2, 0.37, 1.0, 0, 4, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.case_flags & IGNORECASE:\n fold_flags = (self.info.flags & _ALL_ENCODINGS) | self.case_flags\n return max(len(_regex.fold_case(fold_flags, i)) for i in\n self.info.kwargs[self.name])\n else:\n return max(len(i) for i in self.info.kwargs[self.name])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3627_C12", "label": "fold_flags =", "type": "assigned_variable", "loc": [3627, 3627], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3626_C8", "vector": [14, 3, 0.8793, 0.0002, 3, 0.16, 0.0, 69, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fold_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fold_flags = (self.info.flags & _ALL_ENCODINGS) | self.case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3628_C12", "label": "return", "type": "return", "loc": [3628, 3629], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3626_C8", "vector": [13, 3, 0.8796, 0.0005, 3, 0.16, 0.5, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return max(len(_regex.fold_case(fold_flags, i)) for i in\n self.info.kwargs[self.name])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3631_C12", "label": "return", "type": "return", "loc": [3631, 3631], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3626_C8", "vector": [13, 3, 0.8802, 0.0002, 3, 0.16, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return max(len(i) for i in self.info.kwargs[self.name])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3633_C0", "label": "Source", "type": "class", "loc": [3633, 3853], "level": 0, "parent": null, "vector": [3, 0, 0.9074, 0.0536, 0, 0.66, 0.9378, 235, 0, 8, 0, 0, 0, 0, 36], "semantic": {"name": "Source", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Source:\n \"Scanner for the regular expression source string.\"\n def __init__(self, string):\n if isinstance(string, str):\n self.string = string\n self.char_type = chr\n else:\n self.string = string.decode(\"latin-1\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3634_C4", "label": "expression", "type": "expression", "loc": [3634, 3634], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3633_C0", "vector": [8, 1, 0.881, 0.0002, 1, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Scanner for the regular expression source string.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3635_C4", "label": "__init__", "type": "function", "loc": [3635, 3645], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3633_C0", "vector": [2, 1, 0.8824, 0.0027, 1, 0.45, 0.125, 555, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, string):\n if isinstance(string, str):\n self.string = string\n self.char_type = chr\n else:\n self.string = string.decode(\"latin-1\")\n self.char_type = lambda c: bytes([c])\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3636_C8", "label": "if", "type": "if", "loc": [3636, 3641], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3635_C4", "vector": [4, 2, 0.8821, 0.0015, 2, 0.08, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(string, str):\n self.string = string\n self.char_type = chr\n else:\n self.string = string.decode(\"latin-1\")\n self.char_type = lambda c: bytes([c])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3637_C12", "label": "self.string =", "type": "assigned_variable", "loc": [3637, 3637], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3636_C8", "vector": [14, 3, 0.8817, 0.0002, 3, 0.01, 0.0, 182, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.string", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.string = string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3638_C12", "label": "self.char_type =", "type": "assigned_variable", "loc": [3638, 3638], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3636_C8", "vector": [14, 3, 0.8819, 0.0002, 3, 0.01, 0.3333, 776, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.char_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.char_type = chr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3640_C12", "label": "self.string = decode()", "type": "assigned_variable", "loc": [3640, 3640], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3636_C8", "vector": [14, 3, 0.8824, 0.0002, 3, 0.01, 0.6667, 182, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "self.string", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " self.string = string.decode(\"latin-1\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3641_C12", "label": "self.char_type =", "type": "assigned_variable", "loc": [3641, 3641], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3636_C8", "vector": [14, 3, 0.8827, 0.0002, 3, 0.01, 1.0, 776, 9, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.char_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.char_type = lambda c: bytes([c])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3643_C8", "label": "self.pos =", "type": "assigned_variable", "loc": [3643, 3643], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3635_C4", "vector": [14, 2, 0.8832, 0.0002, 2, 0.08, 0.3333, 283, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pos = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3644_C8", "label": "self.ignore_space =", "type": "assigned_variable", "loc": [3644, 3644], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3635_C4", "vector": [14, 2, 0.8834, 0.0002, 2, 0.08, 0.6667, 554, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.ignore_space", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ignore_space = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3645_C8", "label": "self.sep =", "type": "assigned_variable", "loc": [3645, 3645], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3635_C4", "vector": [14, 2, 0.8836, 0.0002, 2, 0.08, 1.0, 1, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.sep", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.sep = string[ : 0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3647_C4", "label": "get", "type": "function", "loc": [3647, 3673], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3633_C0", "vector": [2, 1, 0.8873, 0.0065, 1, 0.45, 0.25, 607, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "get", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self):\n string = self.string\n pos = self.pos\n\n try:\n if self.ignore_space:\n while True:\n if string[pos].isspace():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3648_C8", "label": "string =", "type": "assigned_variable", "loc": [3648, 3648], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3647_C4", "vector": [14, 2, 0.8844, 0.0002, 2, 0.17, 0.0, 890, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "string", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " string = self.string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3649_C8", "label": "pos =", "type": "assigned_variable", "loc": [3649, 3649], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3647_C4", "vector": [14, 2, 0.8846, 0.0002, 2, 0.17, 0.5, 627, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = self.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3651_C8", "label": "try", "type": "try", "loc": [3651, 3673], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3647_C4", "vector": [7, 2, 0.8878, 0.0056, 2, 0.17, 1.0, 0, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if self.ignore_space:\n while True:\n if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1\n elif string[pos] == \"#\":\n # Skip over the comment to the end of the line."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3652_C12", "label": "if", "type": "if", "loc": [3652, 3661], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3651_C8", "vector": [4, 3, 0.8864, 0.0024, 3, 0.22, 0.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ignore_space:\n while True:\n if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1\n elif string[pos] == \"#\":\n # Skip over the comment to the end of the line.\n pos = string.index(\"\\n\", pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3653_C16", "label": "while", "type": "while", "loc": [3653, 3661], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3652_C12", "vector": [5, 4, 0.8865, 0.0022, 4, 0.29, 0.0, 0, 1, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1\n elif string[pos] == \"#\":\n # Skip over the comment to the end of the line.\n pos = string.index(\"\\n\", pos)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3654_C20", "label": "if", "type": "if", "loc": [3654, 3661], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3653_C16", "vector": [4, 5, 0.8867, 0.0019, 5, 0.12, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1\n elif string[pos] == \"#\":\n # Skip over the comment to the end of the line.\n pos = string.index(\"\\n\", pos)\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3657_C20", "label": "if", "type": "if", "loc": [3657, 3661], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3654_C20", "vector": [4, 6, 0.887, 0.0012, 6, 0.29, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif string[pos] == \"#\":\n # Skip over the comment to the end of the line.\n pos = string.index(\"\\n\", pos)\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3659_C24", "label": "pos = index()", "type": "assigned_variable", "loc": [3659, 3659], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3657_C20", "vector": [14, 7, 0.887, 0.0002, 7, 0.22, 0.0, 627, 3, 2, 0, 0, 780, 10, 1], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "index", "annotation": ""}, "snippet": " pos = string.index(\"\\n\", pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3663_C12", "label": "ch =", "type": "assigned_variable", "loc": [3663, 3663], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3651_C8", "vector": [14, 3, 0.888, 0.0002, 3, 0.22, 0.3333, 263, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ch = string[pos]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3664_C12", "label": "self.pos =", "type": "assigned_variable", "loc": [3664, 3664], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3651_C8", "vector": [14, 3, 0.8882, 0.0002, 3, 0.22, 0.6667, 283, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pos = pos + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3665_C12", "label": "return", "type": "return", "loc": [3665, 3665], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3651_C8", "vector": [13, 3, 0.8885, 0.0002, 3, 0.22, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ch"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3668_C12", "label": "self.pos =", "type": "assigned_variable", "loc": [3668, 3668], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3651_C8", "vector": [14, 3, 0.8892, 0.0002, 3, 0.22, 0.0, 283, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pos = pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3669_C12", "label": "return", "type": "return", "loc": [3669, 3669], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3651_C8", "vector": [13, 3, 0.8895, 0.0002, 3, 0.22, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return string[ : 0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3672_C12", "label": "self.pos = len()", "type": "assigned_variable", "loc": [3672, 3672], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3651_C8", "vector": [14, 3, 0.8902, 0.0002, 3, 0.22, 0.0, 283, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " self.pos = len(string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3673_C12", "label": "return", "type": "return", "loc": [3673, 3673], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3651_C8", "vector": [13, 3, 0.8904, 0.0002, 3, 0.22, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return string[ : 0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3675_C4", "label": "get_many", "type": "function", "loc": [3675, 3711], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3633_C0", "vector": [2, 1, 0.8953, 0.009, 1, 0.45, 0.375, 857, 0, 2, 1, 0, 0, 0, 10], "semantic": {"name": "get_many", "arg_names": ["self", "count"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_many(self, count=1):\n string = self.string\n pos = self.pos\n\n try:\n if self.ignore_space:\n substring = []\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3676_C8", "label": "string =", "type": "assigned_variable", "loc": [3676, 3676], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3675_C4", "vector": [14, 2, 0.8912, 0.0002, 2, 0.46, 0.0, 890, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "string", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " string = self.string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3677_C8", "label": "pos =", "type": "assigned_variable", "loc": [3677, 3677], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3675_C4", "vector": [14, 2, 0.8914, 0.0002, 2, 0.46, 0.5, 627, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = self.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3679_C8", "label": "try", "type": "try", "loc": [3679, 3711], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3675_C4", "vector": [7, 2, 0.8958, 0.008, 2, 0.46, 1.0, 0, 0, 2, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if self.ignore_space:\n substring = []\n\n while len(substring) < count:\n while True:\n if string[pos].isspace():\n # Skip over the whitespace."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3680_C12", "label": "if", "type": "if", "loc": [3680, 3700], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3679_C8", "vector": [4, 3, 0.8945, 0.0051, 3, 0.23, 0.0, 0, 7, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ignore_space:\n substring = []\n\n while len(substring) < count:\n while True:\n if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3681_C16", "label": "substring =", "type": "assigned_variable", "loc": [3681, 3681], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3680_C12", "vector": [14, 4, 0.8924, 0.0002, 4, 0.48, 0.0, 677, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "substring", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " substring = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3683_C16", "label": "while", "type": "while", "loc": [3683, 3695], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3680_C12", "vector": [5, 4, 0.8943, 0.0032, 4, 0.48, 0.3333, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while len(substring) < count:\n while True:\n if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1\n elif string[pos] == \"#\":\n # Skip over the comment to the end of the line.\n pos = string.index(\"\\n\", pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3684_C20", "label": "while", "type": "while", "loc": [3684, 3692], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3683_C16", "vector": [5, 5, 0.8941, 0.0022, 5, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1\n elif string[pos] == \"#\":\n # Skip over the comment to the end of the line.\n pos = string.index(\"\\n\", pos)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3685_C24", "label": "if", "type": "if", "loc": [3685, 3692], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3684_C20", "vector": [4, 6, 0.8942, 0.0019, 6, 0.7, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1\n elif string[pos] == \"#\":\n # Skip over the comment to the end of the line.\n pos = string.index(\"\\n\", pos)\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3688_C24", "label": "if", "type": "if", "loc": [3688, 3692], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3685_C24", "vector": [4, 7, 0.8945, 0.0012, 7, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif string[pos] == \"#\":\n # Skip over the comment to the end of the line.\n pos = string.index(\"\\n\", pos)\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3690_C28", "label": "pos = index()", "type": "assigned_variable", "loc": [3690, 3690], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3688_C24", "vector": [14, 8, 0.8945, 0.0002, 8, 0.66, 0.0, 627, 3, 2, 0, 0, 780, 10, 1], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "index", "annotation": ""}, "snippet": " pos = string.index(\"\\n\", pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3694_C20", "label": "append()", "type": "expression", "loc": [3694, 3694], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3683_C16", "vector": [8, 5, 0.8955, 0.0002, 5, 0.37, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " substring.append(string[pos])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3697_C16", "label": "substring = join()", "type": "assigned_variable", "loc": [3697, 3697], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3680_C12", "vector": [14, 4, 0.8962, 0.0002, 4, 0.48, 0.6667, 677, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "substring", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " substring = \"\".join(substring)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3699_C16", "label": "substring =", "type": "assigned_variable", "loc": [3699, 3699], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3680_C12", "vector": [14, 4, 0.8967, 0.0002, 4, 0.48, 1.0, 677, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "substring", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " substring = string[pos : pos + count]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3702_C12", "label": "self.pos =", "type": "assigned_variable", "loc": [3702, 3702], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3679_C8", "vector": [14, 3, 0.8975, 0.0002, 3, 0.23, 0.5, 283, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pos = pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3703_C12", "label": "return", "type": "return", "loc": [3703, 3703], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3679_C8", "vector": [13, 3, 0.8977, 0.0002, 3, 0.23, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return substring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3706_C12", "label": "self.pos = len()", "type": "assigned_variable", "loc": [3706, 3706], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3679_C8", "vector": [14, 3, 0.8984, 0.0002, 3, 0.23, 0.0, 283, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " self.pos = len(string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3707_C12", "label": "return", "type": "return", "loc": [3707, 3707], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3679_C8", "vector": [13, 3, 0.8987, 0.0002, 3, 0.23, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"\".join(substring)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3710_C12", "label": "self.pos = len()", "type": "assigned_variable", "loc": [3710, 3710], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3679_C8", "vector": [14, 3, 0.8994, 0.0002, 3, 0.23, 0.0, 283, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " self.pos = len(string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3711_C12", "label": "return", "type": "return", "loc": [3711, 3711], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3679_C8", "vector": [13, 3, 0.8996, 0.0002, 3, 0.23, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"\".join(substring)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3713_C4", "label": "get_while", "type": "function", "loc": [3713, 3759], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3633_C0", "vector": [2, 1, 0.9057, 0.0114, 1, 0.45, 0.5, 729, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "get_while", "arg_names": ["self", "test_set", "include"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_while(self, test_set, include=True):\n string = self.string\n pos = self.pos\n\n if self.ignore_space:\n try:\n substring = []\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3714_C8", "label": "string =", "type": "assigned_variable", "loc": [3714, 3714], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3713_C4", "vector": [14, 2, 0.9004, 0.0002, 2, 0.75, 0.0, 890, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "string", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " string = self.string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3715_C8", "label": "pos =", "type": "assigned_variable", "loc": [3715, 3715], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3713_C4", "vector": [14, 2, 0.9006, 0.0002, 2, 0.75, 0.5, 627, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = self.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3717_C8", "label": "if", "type": "if", "loc": [3717, 3759], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3713_C4", "vector": [4, 2, 0.9062, 0.0104, 2, 0.75, 1.0, 0, 7, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ignore_space:\n try:\n substring = []\n\n while True:\n if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3718_C12", "label": "try", "type": "try", "loc": [3718, 3740], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3717_C8", "vector": [7, 3, 0.904, 0.0056, 3, 0.77, 0.0, 0, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n substring = []\n\n while True:\n if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1\n elif string[pos] == \"#\":"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3719_C16", "label": "substring =", "type": "assigned_variable", "loc": [3719, 3719], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3718_C12", "vector": [14, 4, 0.9016, 0.0002, 4, 0.04, 0.0, 677, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "substring", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " substring = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3721_C16", "label": "while", "type": "while", "loc": [3721, 3732], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3718_C12", "vector": [5, 4, 0.9034, 0.0029, 4, 0.04, 0.5, 0, 1, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1\n elif string[pos] == \"#\":\n # Skip over the comment to the end of the line.\n pos = string.index(\"\\n\", pos)\n elif (string[pos] in test_set) == include:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3722_C20", "label": "if", "type": "if", "loc": [3722, 3732], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3721_C16", "vector": [4, 5, 0.9035, 0.0027, 5, 0.04, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1\n elif string[pos] == \"#\":\n # Skip over the comment to the end of the line.\n pos = string.index(\"\\n\", pos)\n elif (string[pos] in test_set) == include:\n substring.append(string[pos])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3725_C20", "label": "if", "type": "if", "loc": [3725, 3732], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3722_C20", "vector": [4, 6, 0.9039, 0.0019, 6, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif string[pos] == \"#\":\n # Skip over the comment to the end of the line.\n pos = string.index(\"\\n\", pos)\n elif (string[pos] in test_set) == include:\n substring.append(string[pos])\n pos += 1\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3727_C24", "label": "pos = index()", "type": "assigned_variable", "loc": [3727, 3727], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3725_C20", "vector": [14, 7, 0.9035, 0.0002, 7, 0.81, 0.0, 627, 3, 2, 0, 0, 780, 10, 1], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "index", "annotation": ""}, "snippet": " pos = string.index(\"\\n\", pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3728_C20", "label": "if", "type": "if", "loc": [3728, 3732], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3725_C20", "vector": [4, 7, 0.9042, 0.0012, 7, 0.81, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif (string[pos] in test_set) == include:\n substring.append(string[pos])\n pos += 1\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3729_C24", "label": "append()", "type": "expression", "loc": [3729, 3729], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3728_C20", "vector": [8, 8, 0.904, 0.0002, 8, 0.94, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " substring.append(string[pos])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3734_C16", "label": "self.pos =", "type": "assigned_variable", "loc": [3734, 3734], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3718_C12", "vector": [14, 4, 0.9052, 0.0002, 4, 0.04, 1.0, 283, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pos = pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3737_C16", "label": "self.pos = len()", "type": "assigned_variable", "loc": [3737, 3737], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3718_C12", "vector": [14, 4, 0.9059, 0.0002, 4, 0.04, 0.0, 283, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " self.pos = len(string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3740_C16", "label": "self.pos = len()", "type": "assigned_variable", "loc": [3740, 3740], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3718_C12", "vector": [14, 4, 0.9067, 0.0002, 4, 0.04, 0.0, 283, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " self.pos = len(string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3742_C12", "label": "return", "type": "return", "loc": [3742, 3742], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3717_C8", "vector": [13, 3, 0.9072, 0.0002, 3, 0.77, 0.5, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"\".join(substring)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3744_C12", "label": "try", "type": "try", "loc": [3744, 3759], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3717_C8", "vector": [7, 3, 0.9095, 0.0039, 3, 0.77, 1.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n while (string[pos] in test_set) == include:\n pos += 1\n\n substring = string[self.pos : pos]\n\n self.pos = pos\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3745_C16", "label": "while", "type": "while", "loc": [3745, 3746], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3744_C12", "vector": [5, 4, 0.908, 0.0005, 4, 0.51, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while (string[pos] in test_set) == include:\n pos += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3748_C16", "label": "substring =", "type": "assigned_variable", "loc": [3748, 3748], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3744_C12", "vector": [14, 4, 0.9086, 0.0002, 4, 0.51, 0.3333, 677, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "substring", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " substring = string[self.pos : pos]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3750_C16", "label": "self.pos =", "type": "assigned_variable", "loc": [3750, 3750], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3744_C12", "vector": [14, 4, 0.9091, 0.0002, 4, 0.51, 0.6667, 283, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pos = pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3752_C16", "label": "return", "type": "return", "loc": [3752, 3752], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3744_C12", "vector": [13, 4, 0.9096, 0.0002, 4, 0.51, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return substring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3755_C16", "label": "substring =", "type": "assigned_variable", "loc": [3755, 3755], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3744_C12", "vector": [14, 4, 0.9103, 0.0002, 4, 0.51, 0.0, 677, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "substring", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " substring = string[self.pos : pos]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3757_C16", "label": "self.pos =", "type": "assigned_variable", "loc": [3757, 3757], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3744_C12", "vector": [14, 4, 0.9108, 0.0002, 4, 0.51, 0.5, 283, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pos = pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3759_C16", "label": "return", "type": "return", "loc": [3759, 3759], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3744_C12", "vector": [13, 4, 0.9113, 0.0002, 4, 0.51, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return substring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3761_C4", "label": "skip_while", "type": "function", "loc": [3761, 3788], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3633_C0", "vector": [2, 1, 0.915, 0.0068, 1, 0.45, 0.625, 410, 0, 3, 0, 0, 0, 0, 4], "semantic": {"name": "skip_while", "arg_names": ["self", "test_set", "include"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def skip_while(self, test_set, include=True):\n string = self.string\n pos = self.pos\n\n try:\n if self.ignore_space:\n while True:\n if string[pos].isspace():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3762_C8", "label": "string =", "type": "assigned_variable", "loc": [3762, 3762], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3761_C4", "vector": [14, 2, 0.912, 0.0002, 2, 0.25, 0.0, 890, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "string", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " string = self.string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3763_C8", "label": "pos =", "type": "assigned_variable", "loc": [3763, 3763], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3761_C4", "vector": [14, 2, 0.9122, 0.0002, 2, 0.25, 0.5, 627, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = self.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3765_C8", "label": "try", "type": "try", "loc": [3765, 3788], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3761_C4", "vector": [7, 2, 0.9155, 0.0058, 2, 0.25, 1.0, 0, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if self.ignore_space:\n while True:\n if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1\n elif string[pos] == \"#\":\n # Skip over the comment to the end of the line."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3766_C12", "label": "if", "type": "if", "loc": [3766, 3780], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3765_C8", "vector": [4, 3, 0.9147, 0.0036, 3, 0.11, 0.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ignore_space:\n while True:\n if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1\n elif string[pos] == \"#\":\n # Skip over the comment to the end of the line.\n pos = string.index(\"\\n\", pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3767_C16", "label": "while", "type": "while", "loc": [3767, 3777], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3766_C12", "vector": [5, 4, 0.9144, 0.0027, 4, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1\n elif string[pos] == \"#\":\n # Skip over the comment to the end of the line.\n pos = string.index(\"\\n\", pos)\n elif (string[pos] in test_set) == include:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3768_C20", "label": "if", "type": "if", "loc": [3768, 3777], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3767_C16", "vector": [4, 5, 0.9145, 0.0024, 5, 0.64, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1\n elif string[pos] == \"#\":\n # Skip over the comment to the end of the line.\n pos = string.index(\"\\n\", pos)\n elif (string[pos] in test_set) == include:\n pos += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3771_C20", "label": "if", "type": "if", "loc": [3771, 3777], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3768_C20", "vector": [4, 6, 0.9149, 0.0017, 6, 0.44, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif string[pos] == \"#\":\n # Skip over the comment to the end of the line.\n pos = string.index(\"\\n\", pos)\n elif (string[pos] in test_set) == include:\n pos += 1\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3773_C24", "label": "pos = index()", "type": "assigned_variable", "loc": [3773, 3773], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3771_C20", "vector": [14, 7, 0.9147, 0.0002, 7, 0.76, 0.0, 627, 3, 2, 0, 0, 780, 10, 1], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "index", "annotation": ""}, "snippet": " pos = string.index(\"\\n\", pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3774_C20", "label": "if", "type": "if", "loc": [3774, 3777], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3771_C20", "vector": [4, 7, 0.9153, 0.001, 7, 0.76, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif (string[pos] in test_set) == include:\n pos += 1\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3779_C16", "label": "while", "type": "while", "loc": [3779, 3780], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3766_C12", "vector": [5, 4, 0.9162, 0.0005, 4, 0.31, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while (string[pos] in test_set) == include:\n pos += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3782_C12", "label": "self.pos =", "type": "assigned_variable", "loc": [3782, 3782], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3765_C8", "vector": [14, 3, 0.9168, 0.0002, 3, 0.11, 1.0, 283, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pos = pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3785_C12", "label": "self.pos = len()", "type": "assigned_variable", "loc": [3785, 3785], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3765_C8", "vector": [14, 3, 0.9176, 0.0002, 3, 0.11, 0.0, 283, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " self.pos = len(string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3788_C12", "label": "self.pos = len()", "type": "assigned_variable", "loc": [3788, 3788], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3765_C8", "vector": [14, 3, 0.9183, 0.0002, 3, 0.11, 0.0, 283, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " self.pos = len(string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3790_C4", "label": "match", "type": "function", "loc": [3790, 3827], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3633_C0", "vector": [2, 1, 0.9233, 0.0092, 1, 0.45, 0.75, 36, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "match", "arg_names": ["self", "substring"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def match(self, substring):\n string = self.string\n pos = self.pos\n\n if self.ignore_space:\n try:\n for c in substring:\n while True:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3791_C8", "label": "string =", "type": "assigned_variable", "loc": [3791, 3791], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3790_C4", "vector": [14, 2, 0.919, 0.0002, 2, 0.49, 0.0, 890, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "string", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " string = self.string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3792_C8", "label": "pos =", "type": "assigned_variable", "loc": [3792, 3792], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3790_C4", "vector": [14, 2, 0.9193, 0.0002, 2, 0.49, 0.5, 627, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = self.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3794_C8", "label": "if", "type": "if", "loc": [3794, 3827], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3790_C4", "vector": [4, 2, 0.9238, 0.0082, 2, 0.49, 1.0, 0, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ignore_space:\n try:\n for c in substring:\n while True:\n if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1\n elif string[pos] == \"#\":"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3795_C12", "label": "try", "type": "try", "loc": [3795, 3820], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3794_C8", "vector": [7, 3, 0.923, 0.0063, 3, 0.66, 0.0, 0, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n for c in substring:\n while True:\n if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1\n elif string[pos] == \"#\":\n # Skip over the comment to the end of the line."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3796_C16", "label": "for c", "type": "for", "loc": [3796, 3810], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3795_C12", "vector": [6, 4, 0.9219, 0.0036, 4, 0.47, 0.0, 411, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in substring:\n while True:\n if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1\n elif string[pos] == \"#\":\n # Skip over the comment to the end of the line.\n pos = string.index(\"\\n\", pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3797_C20", "label": "while", "type": "while", "loc": [3797, 3805], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3796_C16", "vector": [5, 5, 0.9215, 0.0022, 5, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1\n elif string[pos] == \"#\":\n # Skip over the comment to the end of the line.\n pos = string.index(\"\\n\", pos)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3798_C24", "label": "if", "type": "if", "loc": [3798, 3805], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3797_C20", "vector": [4, 6, 0.9216, 0.0019, 6, 0.7, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if string[pos].isspace():\n # Skip over the whitespace.\n pos += 1\n elif string[pos] == \"#\":\n # Skip over the comment to the end of the line.\n pos = string.index(\"\\n\", pos)\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3801_C24", "label": "if", "type": "if", "loc": [3801, 3805], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3798_C24", "vector": [4, 7, 0.9219, 0.0012, 7, 0.89, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif string[pos] == \"#\":\n # Skip over the comment to the end of the line.\n pos = string.index(\"\\n\", pos)\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3803_C28", "label": "pos = index()", "type": "assigned_variable", "loc": [3803, 3803], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3801_C24", "vector": [14, 8, 0.9219, 0.0002, 8, 0.88, 0.0, 627, 3, 2, 0, 0, 780, 10, 1], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "index", "annotation": ""}, "snippet": " pos = string.index(\"\\n\", pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3807_C20", "label": "if", "type": "if", "loc": [3807, 3808], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3796_C16", "vector": [4, 5, 0.923, 0.0005, 5, 0.45, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if string[pos] != c:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3808_C24", "label": "return", "type": "return", "loc": [3808, 3808], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3807_C20", "vector": [13, 6, 0.9232, 0.0002, 6, 0.7, 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_1389:Assign_L3812_C16", "label": "self.pos =", "type": "assigned_variable", "loc": [3812, 3812], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3795_C12", "vector": [14, 4, 0.9241, 0.0002, 4, 0.47, 0.5, 283, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pos = pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3814_C16", "label": "return", "type": "return", "loc": [3814, 3814], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3795_C12", "vector": [13, 4, 0.9246, 0.0002, 4, 0.47, 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_1389:Return_L3817_C16", "label": "return", "type": "return", "loc": [3817, 3817], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3795_C12", "vector": [13, 4, 0.9253, 0.0002, 4, 0.47, 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_1389:Return_L3820_C16", "label": "return", "type": "return", "loc": [3820, 3820], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3795_C12", "vector": [13, 4, 0.9261, 0.0002, 4, 0.47, 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_1389:If_L3822_C12", "label": "if", "type": "if", "loc": [3822, 3823], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3794_C8", "vector": [4, 3, 0.9267, 0.0005, 3, 0.66, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not string.startswith(substring, pos):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3823_C16", "label": "return", "type": "return", "loc": [3823, 3823], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3822_C12", "vector": [13, 4, 0.9268, 0.0002, 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_1389:Assign_L3825_C12", "label": "self.pos =", "type": "assigned_variable", "loc": [3825, 3825], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3794_C8", "vector": [14, 3, 0.9273, 0.0002, 3, 0.66, 0.6667, 283, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pos = pos + len(substring)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3827_C12", "label": "return", "type": "return", "loc": [3827, 3827], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3794_C8", "vector": [13, 3, 0.9278, 0.0002, 3, 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_1389:FunctionDef_L3829_C4", "label": "expect", "type": "function", "loc": [3829, 3831], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3633_C0", "vector": [2, 1, 0.9285, 0.0007, 1, 0.45, 0.875, 754, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "expect", "arg_names": ["self", "substring"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def expect(self, substring):\n if not self.match(substring):\n raise error(\"missing {}\".format(substring), self.string, self.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3830_C8", "label": "if", "type": "if", "loc": [3830, 3831], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3829_C4", "vector": [4, 2, 0.9286, 0.0005, 2, 0.96, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.match(substring):\n raise error(\"missing {}\".format(substring), self.string, self.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3833_C4", "label": "at_end", "type": "function", "loc": [3833, 3853], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3633_C0", "vector": [2, 1, 0.9316, 0.0051, 1, 0.45, 1.0, 210, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "at_end", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def at_end(self):\n string = self.string\n pos = self.pos\n\n try:\n if self.ignore_space:\n while True:\n if string[pos].isspace():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3834_C8", "label": "string =", "type": "assigned_variable", "loc": [3834, 3834], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3833_C4", "vector": [14, 2, 0.9295, 0.0002, 2, 0.9, 0.0, 890, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "string", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " string = self.string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3835_C8", "label": "pos =", "type": "assigned_variable", "loc": [3835, 3835], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3833_C4", "vector": [14, 2, 0.9297, 0.0002, 2, 0.9, 0.5, 627, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = self.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3837_C8", "label": "try", "type": "try", "loc": [3837, 3853], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3833_C4", "vector": [7, 2, 0.9321, 0.0041, 2, 0.9, 1.0, 0, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if self.ignore_space:\n while True:\n if string[pos].isspace():\n pos += 1\n elif string[pos] == \"#\":\n pos = string.index(\"\\n\", pos)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3838_C12", "label": "if", "type": "if", "loc": [3838, 3845], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3837_C8", "vector": [4, 3, 0.9313, 0.0019, 3, 0.6, 0.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ignore_space:\n while True:\n if string[pos].isspace():\n pos += 1\n elif string[pos] == \"#\":\n pos = string.index(\"\\n\", pos)\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3839_C16", "label": "while", "type": "while", "loc": [3839, 3845], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3838_C12", "vector": [5, 4, 0.9314, 0.0017, 4, 0.51, 0.0, 0, 1, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n if string[pos].isspace():\n pos += 1\n elif string[pos] == \"#\":\n pos = string.index(\"\\n\", pos)\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3840_C20", "label": "if", "type": "if", "loc": [3840, 3845], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3839_C16", "vector": [4, 5, 0.9315, 0.0015, 5, 0.9, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if string[pos].isspace():\n pos += 1\n elif string[pos] == \"#\":\n pos = string.index(\"\\n\", pos)\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3842_C20", "label": "if", "type": "if", "loc": [3842, 3845], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3840_C20", "vector": [4, 6, 0.9318, 0.001, 6, 0.28, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif string[pos] == \"#\":\n pos = string.index(\"\\n\", pos)\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3843_C24", "label": "pos = index()", "type": "assigned_variable", "loc": [3843, 3843], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3842_C20", "vector": [14, 7, 0.9316, 0.0002, 7, 0.71, 0.0, 627, 3, 2, 0, 0, 780, 10, 1], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "index", "annotation": ""}, "snippet": " pos = string.index(\"\\n\", pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3847_C12", "label": "return", "type": "return", "loc": [3847, 3847], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3837_C8", "vector": [13, 3, 0.9326, 0.0002, 3, 0.6, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return pos >= len(string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3850_C12", "label": "return", "type": "return", "loc": [3850, 3850], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3837_C8", "vector": [13, 3, 0.9333, 0.0002, 3, 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_1389:Return_L3853_C12", "label": "return", "type": "return", "loc": [3853, 3853], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3837_C8", "vector": [13, 3, 0.9341, 0.0002, 3, 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_1389:ClassDef_L3855_C0", "label": "Info", "type": "class", "loc": [3855, 3918], "level": 0, "parent": null, "vector": [3, 0, 0.9422, 0.0155, 0, 0.66, 0.943, 148, 0, 4, 0, 0, 0, 0, 8], "semantic": {"name": "Info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Info:\n \"Info about the regular expression.\"\n\n def __init__(self, flags=0, char_type=None, kwargs={}):\n flags |= DEFAULT_FLAGS[(flags & _ALL_VERSIONS) or DEFAULT_VERSION]\n self.flags = flags\n self.global_flags = flags\n self.inline_locale = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3856_C4", "label": "expression", "type": "expression", "loc": [3856, 3856], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3855_C0", "vector": [8, 1, 0.9348, 0.0002, 1, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Info about the regular expression.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "label": "__init__", "type": "function", "loc": [3858, 3875], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3855_C0", "vector": [2, 1, 0.9373, 0.0044, 1, 0.37, 0.25, 555, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "flags", "char_type", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, flags=0, char_type=None, kwargs={}):\n flags |= DEFAULT_FLAGS[(flags & _ALL_VERSIONS) or DEFAULT_VERSION]\n self.flags = flags\n self.global_flags = flags\n self.inline_locale = False\n\n self.kwargs = kwargs\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3860_C8", "label": "self.flags =", "type": "assigned_variable", "loc": [3860, 3860], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "vector": [14, 2, 0.9358, 0.0002, 2, 0.36, 0.0, 478, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.flags = flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3861_C8", "label": "self.global_flags =", "type": "assigned_variable", "loc": [3861, 3861], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "vector": [14, 2, 0.936, 0.0002, 2, 0.36, 0.0769, 641, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.global_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.global_flags = flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3862_C8", "label": "self.inline_locale =", "type": "assigned_variable", "loc": [3862, 3862], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "vector": [14, 2, 0.9362, 0.0002, 2, 0.36, 0.1538, 712, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.inline_locale", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.inline_locale = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3864_C8", "label": "self.kwargs =", "type": "assigned_variable", "loc": [3864, 3864], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "vector": [14, 2, 0.9367, 0.0002, 2, 0.36, 0.2308, 790, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.kwargs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.kwargs = kwargs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3866_C8", "label": "self.group_count =", "type": "assigned_variable", "loc": [3866, 3866], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "vector": [14, 2, 0.9372, 0.0002, 2, 0.36, 0.3077, 652, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.group_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.group_count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3867_C8", "label": "self.group_index =", "type": "assigned_variable", "loc": [3867, 3867], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "vector": [14, 2, 0.9375, 0.0002, 2, 0.36, 0.3846, 219, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.group_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.group_index = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3868_C8", "label": "self.group_name =", "type": "assigned_variable", "loc": [3868, 3868], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "vector": [14, 2, 0.9377, 0.0002, 2, 0.36, 0.4615, 473, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.group_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.group_name = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3869_C8", "label": "self.char_type =", "type": "assigned_variable", "loc": [3869, 3869], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "vector": [14, 2, 0.9379, 0.0002, 2, 0.36, 0.5385, 776, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.char_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.char_type = char_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3870_C8", "label": "self.named_lists_used =", "type": "assigned_variable", "loc": [3870, 3870], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "vector": [14, 2, 0.9382, 0.0002, 2, 0.36, 0.6154, 612, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.named_lists_used", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.named_lists_used = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3871_C8", "label": "self.open_groups =", "type": "assigned_variable", "loc": [3871, 3871], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "vector": [14, 2, 0.9384, 0.0002, 2, 0.36, 0.6923, 611, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.open_groups", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.open_groups = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3872_C8", "label": "self.open_group_count =", "type": "assigned_variable", "loc": [3872, 3872], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "vector": [14, 2, 0.9387, 0.0002, 2, 0.36, 0.7692, 126, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.open_group_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.open_group_count = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3873_C8", "label": "self.defined_groups =", "type": "assigned_variable", "loc": [3873, 3873], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "vector": [14, 2, 0.9389, 0.0002, 2, 0.36, 0.8462, 304, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.defined_groups", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.defined_groups = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3874_C8", "label": "self.group_calls =", "type": "assigned_variable", "loc": [3874, 3874], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "vector": [14, 2, 0.9392, 0.0002, 2, 0.36, 0.9231, 693, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.group_calls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.group_calls = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3875_C8", "label": "self.private_groups =", "type": "assigned_variable", "loc": [3875, 3875], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "vector": [14, 2, 0.9394, 0.0002, 2, 0.36, 1.0, 104, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.private_groups", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.private_groups = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3877_C4", "label": "open_group", "type": "function", "loc": [3877, 3901], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3855_C0", "vector": [2, 1, 0.9428, 0.0061, 1, 0.37, 0.5, 857, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "open_group", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def open_group(self, name=None):\n group = self.group_index.get(name)\n if group is None:\n while True:\n self.group_count += 1\n if name is None or self.group_count not in self.group_name:\n break\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3878_C8", "label": "group = get()", "type": "assigned_variable", "loc": [3878, 3878], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3877_C4", "vector": [14, 2, 0.9401, 0.0002, 2, 0.85, 0.0, 43, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "group", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " group = self.group_index.get(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3879_C8", "label": "if", "type": "if", "loc": [3879, 3888], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3877_C4", "vector": [4, 2, 0.9415, 0.0024, 2, 0.85, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if group is None:\n while True:\n self.group_count += 1\n if name is None or self.group_count not in self.group_name:\n break\n\n group = self.group_count\n if name:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3880_C12", "label": "while", "type": "while", "loc": [3880, 3883], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3879_C8", "vector": [5, 3, 0.941, 0.001, 3, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n self.group_count += 1\n if name is None or self.group_count not in self.group_name:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3882_C16", "label": "if", "type": "if", "loc": [3882, 3883], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3880_C12", "vector": [4, 4, 0.9412, 0.0005, 4, 0.59, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name is None or self.group_count not in self.group_name:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3885_C12", "label": "group =", "type": "assigned_variable", "loc": [3885, 3885], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3879_C8", "vector": [14, 3, 0.9418, 0.0002, 3, 0.79, 0.5, 43, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " group = self.group_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3886_C12", "label": "if", "type": "if", "loc": [3886, 3888], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3879_C8", "vector": [4, 3, 0.9423, 0.0007, 3, 0.79, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name:\n self.group_index[name] = group\n self.group_name[group] = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3887_C16", "label": "assign", "type": "assigned_variable", "loc": [3887, 3887], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3886_C12", "vector": [14, 4, 0.9423, 0.0002, 4, 0.83, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.group_index[name] = group"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3888_C16", "label": "assign", "type": "assigned_variable", "loc": [3888, 3888], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3886_C12", "vector": [14, 4, 0.9425, 0.0002, 4, 0.83, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.group_name[group] = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3890_C8", "label": "if", "type": "if", "loc": [3890, 3896], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3877_C4", "vector": [4, 2, 0.9438, 0.0017, 2, 0.85, 0.4, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if group in self.open_groups:\n # We have a nested named group. We'll assign it a private group\n # number, initially negative until we can assign a proper\n # (positive) number.\n group_alias = -(len(self.private_groups) + 1)\n self.private_groups[group_alias] = group\n group = group_alias"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3894_C12", "label": "group_alias =", "type": "assigned_variable", "loc": [3894, 3894], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3890_C8", "vector": [14, 3, 0.944, 0.0002, 3, 0.58, 0.0, 357, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "group_alias", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " group_alias = -(len(self.private_groups) + 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3895_C12", "label": "assign", "type": "assigned_variable", "loc": [3895, 3895], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3890_C8", "vector": [14, 3, 0.9442, 0.0002, 3, 0.58, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.private_groups[group_alias] = group"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3896_C12", "label": "group =", "type": "assigned_variable", "loc": [3896, 3896], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3890_C8", "vector": [14, 3, 0.9445, 0.0002, 3, 0.58, 1.0, 43, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " group = group_alias"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3898_C8", "label": "append()", "type": "expression", "loc": [3898, 3898], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3877_C4", "vector": [8, 2, 0.945, 0.0002, 2, 0.85, 0.6, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.open_groups.append(group)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3899_C8", "label": "assign", "type": "assigned_variable", "loc": [3899, 3899], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3877_C4", "vector": [14, 2, 0.9452, 0.0002, 2, 0.85, 0.8, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.open_group_count[group] = self.open_group_count.get(group, 0) + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3901_C8", "label": "return", "type": "return", "loc": [3901, 3901], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3877_C4", "vector": [13, 2, 0.9457, 0.0002, 2, 0.85, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return group"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3903_C4", "label": "close_group", "type": "function", "loc": [3903, 3904], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3855_C0", "vector": [2, 1, 0.9463, 0.0005, 1, 0.37, 0.75, 764, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "close_group", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def close_group(self):\n self.open_groups.pop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3904_C8", "label": "pop()", "type": "expression", "loc": [3904, 3904], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3903_C4", "vector": [8, 2, 0.9464, 0.0002, 2, 0.35, 0.0, 969, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pop", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " self.open_groups.pop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3906_C4", "label": "is_open_group", "type": "function", "loc": [3906, 3918], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3855_C0", "vector": [2, 1, 0.9484, 0.0032, 1, 0.37, 1.0, 509, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "is_open_group", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_open_group(self, name):\n # In version 1, a group reference can refer to an open group. We'll\n # just pretend the group isn't open.\n version = (self.flags & _ALL_VERSIONS) or DEFAULT_VERSION\n if version == VERSION1:\n return False\n\n if name.isdigit():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3909_C8", "label": "version =", "type": "assigned_variable", "loc": [3909, 3909], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3906_C4", "vector": [14, 2, 0.9476, 0.0002, 2, 0.98, 0.0, 623, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = (self.flags & _ALL_VERSIONS) or DEFAULT_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3910_C8", "label": "if", "type": "if", "loc": [3910, 3911], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3906_C4", "vector": [4, 2, 0.948, 0.0005, 2, 0.98, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version == VERSION1:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3911_C12", "label": "return", "type": "return", "loc": [3911, 3911], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3910_C8", "vector": [13, 3, 0.9481, 0.0002, 3, 0.63, 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_1389:If_L3913_C8", "label": "if", "type": "if", "loc": [3913, 3916], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3906_C4", "vector": [4, 2, 0.949, 0.001, 2, 0.98, 0.6667, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name.isdigit():\n group = int(name)\n else:\n group = self.group_index.get(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3914_C12", "label": "group = int()", "type": "assigned_variable", "loc": [3914, 3914], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3913_C8", "vector": [14, 3, 0.9488, 0.0002, 3, 0.68, 0.0, 43, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "group", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " group = int(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3916_C12", "label": "group = get()", "type": "assigned_variable", "loc": [3916, 3916], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3913_C8", "vector": [14, 3, 0.9493, 0.0002, 3, 0.68, 1.0, 43, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "group", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " group = self.group_index.get(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3918_C8", "label": "return", "type": "return", "loc": [3918, 3918], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3906_C4", "vector": [13, 2, 0.9498, 0.0002, 2, 0.98, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return group in self.open_groups"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3920_C0", "label": "_check_group_features", "type": "function", "loc": [3920, 3956], "level": 0, "parent": null, "vector": [2, 0, 0.9547, 0.009, 0, 0.66, 0.9482, 534, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "_check_group_features", "arg_names": ["info", "parsed"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _check_group_features(info, parsed):\n \"\"\"Checks whether the reverse and fuzzy features of the group calls match\n the groups which they call.\n \"\"\"\n call_refs = {}\n additional_groups = []\n for call, reverse, fuzzy in info.group_calls:\n # Look up the reference of this group call."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3921_C4", "label": "expression", "type": "expression", "loc": [3921, 3923], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3920_C0", "vector": [8, 1, 0.9508, 0.0007, 1, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Checks whether the reverse and fuzzy features of the group calls match\n the groups which they call.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3924_C4", "label": "call_refs =", "type": "assigned_variable", "loc": [3924, 3924], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3920_C0", "vector": [14, 1, 0.9513, 0.0002, 1, 0.64, 0.2, 971, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "call_refs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " call_refs = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3925_C4", "label": "additional_groups =", "type": "assigned_variable", "loc": [3925, 3925], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3920_C0", "vector": [14, 1, 0.9515, 0.0002, 1, 0.64, 0.4, 45, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "additional_groups", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " additional_groups = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3926_C4", "label": "for call, reverse, fuzzy", "type": "for", "loc": [3926, 3953], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3920_C0", "vector": [6, 1, 0.955, 0.0068, 1, 0.64, 0.6, 219, 7, 0, 0, 0, 0, 0, 6], "semantic": {"name": "call, reverse, fuzzy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for call, reverse, fuzzy in info.group_calls:\n # Look up the reference of this group call.\n key = (call.group, reverse, fuzzy)\n ref = call_refs.get(key)\n if ref is None:\n # This group doesn't have a reference yet, so look up its features.\n if call.group == 0:\n # Calling the pattern as a whole."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3928_C8", "label": "key =", "type": "assigned_variable", "loc": [3928, 3928], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3926_C4", "vector": [14, 2, 0.9522, 0.0002, 2, 0.6, 0.0, 230, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = (call.group, reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3929_C8", "label": "ref = get()", "type": "assigned_variable", "loc": [3929, 3929], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3926_C4", "vector": [14, 2, 0.9525, 0.0002, 2, 0.6, 0.3333, 686, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "ref", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ref = call_refs.get(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3930_C8", "label": "if", "type": "if", "loc": [3930, 3951], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3926_C4", "vector": [4, 2, 0.9553, 0.0053, 2, 0.6, 0.6667, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ref is None:\n # This group doesn't have a reference yet, so look up its features.\n if call.group == 0:\n # Calling the pattern as a whole.\n rev = bool(info.flags & REVERSE)\n fuz = isinstance(parsed, Fuzzy)\n if (rev, fuz) != (reverse, fuzzy):\n # The pattern as a whole doesn't have the features we want,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3932_C12", "label": "if", "type": "if", "loc": [3932, 3948], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3930_C8", "vector": [4, 3, 0.9552, 0.0041, 3, 0.54, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if call.group == 0:\n # Calling the pattern as a whole.\n rev = bool(info.flags & REVERSE)\n fuz = isinstance(parsed, Fuzzy)\n if (rev, fuz) != (reverse, fuzzy):\n # The pattern as a whole doesn't have the features we want,\n # so we'll need to make a copy of it with the desired\n # features."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3934_C16", "label": "rev = bool()", "type": "assigned_variable", "loc": [3934, 3934], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3932_C12", "vector": [14, 4, 0.9537, 0.0002, 4, 0.36, 0.0, 337, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "rev", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " rev = bool(info.flags & REVERSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3935_C16", "label": "fuz = isinstance()", "type": "assigned_variable", "loc": [3935, 3935], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3932_C12", "vector": [14, 4, 0.9539, 0.0002, 4, 0.36, 0.2, 579, 3, 2, 0, 0, 552, 10, 1], "semantic": {"name": "fuz", "arg_names": [], "import_names": [], "rhs_call_name": "isinstance", "annotation": ""}, "snippet": " fuz = isinstance(parsed, Fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3936_C16", "label": "if", "type": "if", "loc": [3936, 3940], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3932_C12", "vector": [4, 4, 0.9547, 0.0012, 4, 0.36, 0.4, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (rev, fuz) != (reverse, fuzzy):\n # The pattern as a whole doesn't have the features we want,\n # so we'll need to make a copy of it with the desired\n # features.\n additional_groups.append((parsed, reverse, fuzzy))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3940_C20", "label": "append()", "type": "expression", "loc": [3940, 3940], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3936_C16", "vector": [8, 5, 0.9552, 0.0002, 5, 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": " additional_groups.append((parsed, reverse, fuzzy))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3943_C16", "label": "def_info =", "type": "assigned_variable", "loc": [3943, 3943], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3932_C12", "vector": [14, 4, 0.9559, 0.0002, 4, 0.36, 0.6, 181, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "def_info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def_info = info.defined_groups[call.group]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3944_C16", "label": "group =", "type": "assigned_variable", "loc": [3944, 3944], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3932_C12", "vector": [14, 4, 0.9561, 0.0002, 4, 0.36, 0.8, 43, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " group = def_info[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3945_C16", "label": "if", "type": "if", "loc": [3945, 3948], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3932_C12", "vector": [4, 4, 0.9567, 0.001, 4, 0.36, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if def_info[1 : ] != (reverse, fuzzy):\n # The group doesn't have the features we want, so we'll\n # need to make a copy of it with the desired features.\n additional_groups.append((group, reverse, fuzzy))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3948_C20", "label": "append()", "type": "expression", "loc": [3948, 3948], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3945_C16", "vector": [8, 5, 0.9571, 0.0002, 5, 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": " additional_groups.append((group, reverse, fuzzy))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3950_C12", "label": "ref = len()", "type": "assigned_variable", "loc": [3950, 3950], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3930_C8", "vector": [14, 3, 0.9576, 0.0002, 3, 0.54, 0.5, 686, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "ref", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " ref = len(call_refs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3951_C12", "label": "assign", "type": "assigned_variable", "loc": [3951, 3951], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3930_C8", "vector": [14, 3, 0.9578, 0.0002, 3, 0.54, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " call_refs[key] = ref"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3953_C8", "label": "call.call_ref =", "type": "assigned_variable", "loc": [3953, 3953], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3926_C4", "vector": [14, 2, 0.9583, 0.0002, 2, 0.6, 1.0, 254, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "call.call_ref", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " call.call_ref = ref"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3955_C4", "label": "info.call_refs =", "type": "assigned_variable", "loc": [3955, 3955], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3920_C0", "vector": [14, 1, 0.9588, 0.0002, 1, 0.64, 0.8, 300, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "info.call_refs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " info.call_refs = call_refs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3956_C4", "label": "info.additional_groups =", "type": "assigned_variable", "loc": [3956, 3956], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3920_C0", "vector": [14, 1, 0.959, 0.0002, 1, 0.64, 1.0, 907, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "info.additional_groups", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " info.additional_groups = additional_groups"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3958_C0", "label": "_get_required_string", "type": "function", "loc": [3958, 3977], "level": 0, "parent": null, "vector": [2, 0, 0.9618, 0.0048, 0, 0.66, 0.9534, 809, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "_get_required_string", "arg_names": ["parsed", "flags"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _get_required_string(parsed, flags):\n \"Gets the required string and related info of a parsed pattern.\"\n\n req_offset, required = parsed.get_required_string(bool(flags & REVERSE))\n if required:\n required.required = True\n if req_offset >= UNLIMITED:\n req_offset = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3959_C4", "label": "expression", "type": "expression", "loc": [3959, 3959], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3958_C0", "vector": [8, 1, 0.9598, 0.0002, 1, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Gets the required string and related info of a parsed pattern.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3961_C4", "label": "req_offset, required = get_required_string()", "type": "assigned_variable", "loc": [3961, 3961], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3958_C0", "vector": [14, 1, 0.9602, 0.0002, 1, 0.57, 0.3333, 826, 3, 1, 0, 0, 720, 10, 2], "semantic": {"name": "req_offset, required", "arg_names": [], "import_names": [], "rhs_call_name": "get_required_string", "annotation": ""}, "snippet": " req_offset, required = parsed.get_required_string(bool(flags & REVERSE))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3962_C4", "label": "if", "type": "if", "loc": [3962, 3975], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3958_C0", "vector": [4, 1, 0.9621, 0.0034, 1, 0.57, 0.6667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if required:\n required.required = True\n if req_offset >= UNLIMITED:\n req_offset = -1\n\n req_flags = required.case_flags\n if not (flags & UNICODE):\n req_flags &= ~UNICODE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3963_C8", "label": "required.required =", "type": "assigned_variable", "loc": [3963, 3963], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3962_C4", "vector": [14, 2, 0.9607, 0.0002, 2, 0.06, 0.0, 971, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "required.required", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " required.required = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3964_C8", "label": "if", "type": "if", "loc": [3964, 3965], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3962_C4", "vector": [4, 2, 0.9611, 0.0005, 2, 0.06, 0.1429, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if req_offset >= UNLIMITED:\n req_offset = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3965_C12", "label": "req_offset =", "type": "assigned_variable", "loc": [3965, 3965], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3964_C8", "vector": [14, 3, 0.9612, 0.0002, 3, 0.05, 0.0, 254, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "req_offset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " req_offset = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3967_C8", "label": "req_flags =", "type": "assigned_variable", "loc": [3967, 3967], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3962_C4", "vector": [14, 2, 0.9617, 0.0002, 2, 0.06, 0.2857, 561, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "req_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " req_flags = required.case_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3968_C8", "label": "if", "type": "if", "loc": [3968, 3969], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3962_C4", "vector": [4, 2, 0.9621, 0.0005, 2, 0.06, 0.4286, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not (flags & UNICODE):\n req_flags &= ~UNICODE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3971_C8", "label": "req_chars =", "type": "assigned_variable", "loc": [3971, 3971], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3962_C4", "vector": [14, 2, 0.9627, 0.0002, 2, 0.06, 0.5714, 305, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "req_chars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " req_chars = required.folded_characters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3973_C8", "label": "req_offset =", "type": "assigned_variable", "loc": [3973, 3973], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3962_C4", "vector": [14, 2, 0.9632, 0.0002, 2, 0.06, 0.7143, 254, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "req_offset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " req_offset = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3974_C8", "label": "req_chars =", "type": "assigned_variable", "loc": [3974, 3974], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3962_C4", "vector": [14, 2, 0.9634, 0.0002, 2, 0.06, 0.8571, 305, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "req_chars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " req_chars = ()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3975_C8", "label": "req_flags =", "type": "assigned_variable", "loc": [3975, 3975], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3962_C4", "vector": [14, 2, 0.9636, 0.0002, 2, 0.06, 1.0, 561, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "req_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " req_flags = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3977_C4", "label": "return", "type": "return", "loc": [3977, 3977], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3958_C0", "vector": [13, 1, 0.9641, 0.0002, 1, 0.57, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return req_offset, req_chars, req_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3979_C0", "label": "Scanner", "type": "class", "loc": [3979, 4071], "level": 0, "parent": null, "vector": [3, 0, 0.9758, 0.0225, 0, 0.66, 0.9585, 871, 0, 2, 0, 0, 0, 0, 34], "semantic": {"name": "Scanner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Scanner:\n def __init__(self, lexicon, flags=0):\n self.lexicon = lexicon\n\n # Combine phrases into a compound pattern.\n patterns = []\n for phrase, action in lexicon:\n # Parse the regular expression."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "label": "__init__", "type": "function", "loc": [3980, 4049], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3979_C0", "vector": [2, 1, 0.9732, 0.017, 1, 0.07, 0.0, 555, 0, 3, 0, 0, 0, 0, 27], "semantic": {"name": "__init__", "arg_names": ["self", "lexicon", "flags"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, lexicon, flags=0):\n self.lexicon = lexicon\n\n # Combine phrases into a compound pattern.\n patterns = []\n for phrase, action in lexicon:\n # Parse the regular expression.\n source = Source(phrase)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3981_C8", "label": "self.lexicon =", "type": "assigned_variable", "loc": [3981, 3981], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "vector": [14, 2, 0.9651, 0.0002, 2, 0.28, 0.0, 61, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.lexicon", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.lexicon = lexicon"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3984_C8", "label": "patterns =", "type": "assigned_variable", "loc": [3984, 3984], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "vector": [14, 2, 0.9658, 0.0002, 2, 0.28, 0.0588, 75, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "patterns", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " patterns = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3985_C8", "label": "for phrase, action", "type": "for", "loc": [3985, 3995], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "vector": [6, 2, 0.9673, 0.0027, 2, 0.28, 0.1176, 105, 2, 0, 0, 0, 0, 0, 8], "semantic": {"name": "phrase, action", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for phrase, action in lexicon:\n # Parse the regular expression.\n source = Source(phrase)\n info = Info(flags, source.char_type)\n source.ignore_space = bool(info.flags & VERBOSE)\n parsed = _parse_pattern(source, info)\n if not source.at_end():\n raise error(\"trailing characters\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3987_C12", "label": "source = Source()", "type": "assigned_variable", "loc": [3987, 3987], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3985_C8", "vector": [14, 3, 0.9665, 0.0002, 3, 0.82, 0.0, 703, 3, 1, 0, 0, 235, 10, 1], "semantic": {"name": "source", "arg_names": [], "import_names": [], "rhs_call_name": "Source", "annotation": ""}, "snippet": " source = Source(phrase)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3988_C12", "label": "info = Info()", "type": "assigned_variable", "loc": [3988, 3988], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3985_C8", "vector": [14, 3, 0.9668, 0.0002, 3, 0.82, 0.2, 730, 3, 2, 0, 0, 148, 10, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "Info", "annotation": ""}, "snippet": " info = Info(flags, source.char_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3989_C12", "label": "source.ignore_space = bool()", "type": "assigned_variable", "loc": [3989, 3989], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3985_C8", "vector": [14, 3, 0.967, 0.0002, 3, 0.82, 0.4, 890, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "source.ignore_space", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " source.ignore_space = bool(info.flags & VERBOSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3990_C12", "label": "parsed = _parse_pattern()", "type": "assigned_variable", "loc": [3990, 3990], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3985_C8", "vector": [14, 3, 0.9673, 0.0002, 3, 0.82, 0.6, 313, 3, 2, 0, 0, 68, 10, 1], "semantic": {"name": "parsed", "arg_names": [], "import_names": [], "rhs_call_name": "_parse_pattern", "annotation": ""}, "snippet": " parsed = _parse_pattern(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3991_C12", "label": "if", "type": "if", "loc": [3991, 3992], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3985_C8", "vector": [4, 3, 0.9676, 0.0005, 3, 0.82, 0.8, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not source.at_end():\n raise error(\"trailing characters\", source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3995_C12", "label": "append()", "type": "expression", "loc": [3995, 3995], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3985_C8", "vector": [8, 3, 0.9685, 0.0002, 3, 0.82, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " patterns.append(parsed.remove_captures())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3998_C8", "label": "info = Info()", "type": "assigned_variable", "loc": [3998, 3998], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "vector": [14, 2, 0.9692, 0.0002, 2, 0.28, 0.1765, 730, 3, 1, 0, 0, 148, 10, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "Info", "annotation": ""}, "snippet": " info = Info(flags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3999_C8", "label": "patterns =", "type": "assigned_variable", "loc": [3999, 3999], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "vector": [14, 2, 0.9695, 0.0002, 2, 0.28, 0.2353, 75, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "patterns", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " patterns = [Group(info, g + 1, p) for g, p in enumerate(patterns)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4000_C8", "label": "parsed = Branch()", "type": "assigned_variable", "loc": [4000, 4000], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "vector": [14, 2, 0.9697, 0.0002, 2, 0.28, 0.2941, 313, 3, 1, 0, 0, 855, 10, 1], "semantic": {"name": "parsed", "arg_names": [], "import_names": [], "rhs_call_name": "Branch", "annotation": ""}, "snippet": " parsed = Branch(patterns)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4003_C8", "label": "parsed = optimise()", "type": "assigned_variable", "loc": [4003, 4003], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "vector": [14, 2, 0.9704, 0.0002, 2, 0.28, 0.3529, 313, 3, 1, 0, 0, 265, 10, 1], "semantic": {"name": "parsed", "arg_names": [], "import_names": [], "rhs_call_name": "optimise", "annotation": ""}, "snippet": " parsed = parsed.optimise(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4004_C8", "label": "parsed = pack_characters()", "type": "assigned_variable", "loc": [4004, 4004], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "vector": [14, 2, 0.9707, 0.0002, 2, 0.28, 0.4118, 313, 3, 1, 0, 0, 434, 10, 1], "semantic": {"name": "parsed", "arg_names": [], "import_names": [], "rhs_call_name": "pack_characters", "annotation": ""}, "snippet": " parsed = parsed.pack_characters(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4007_C8", "label": "req_offset, req_chars, req_flags = _get_required_string()", "type": "assigned_variable", "loc": [4007, 4008], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "vector": [14, 2, 0.9715, 0.0005, 2, 0.28, 0.4706, 98, 3, 2, 0, 0, 809, 10, 1], "semantic": {"name": "req_offset, req_chars, req_flags", "arg_names": [], "import_names": [], "rhs_call_name": "_get_required_string", "annotation": ""}, "snippet": " req_offset, req_chars, req_flags = _get_required_string(parsed,\n info.flags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L4011_C8", "label": "_check_group_features()", "type": "expression", "loc": [4011, 4011], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "vector": [8, 2, 0.9724, 0.0002, 2, 0.28, 0.5294, 534, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_check_group_features", "arg_names": [], "import_names": [], "rhs_call_name": "_check_group_features", "annotation": ""}, "snippet": " _check_group_features(info, parsed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4015_C8", "label": "if", "type": "if", "loc": [4015, 4017], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "vector": [4, 2, 0.9736, 0.0007, 2, 0.28, 0.5882, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if info.call_refs:\n raise error(\"recursive regex not supported by Scanner\",\n source.string, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4019_C8", "label": "reverse = bool()", "type": "assigned_variable", "loc": [4019, 4019], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "vector": [14, 2, 0.9743, 0.0002, 2, 0.28, 0.6471, 109, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "reverse", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " reverse = bool(info.flags & REVERSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4022_C8", "label": "code =", "type": "assigned_variable", "loc": [4022, 4022], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "vector": [14, 2, 0.975, 0.0002, 2, 0.28, 0.7059, 44, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " code = parsed.compile(reverse) + [(OP.SUCCESS, )]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4025_C8", "label": "code = _flatten_code()", "type": "assigned_variable", "loc": [4025, 4025], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "vector": [14, 2, 0.9758, 0.0002, 2, 0.28, 0.7647, 44, 3, 1, 0, 0, 863, 10, 1], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "_flatten_code", "annotation": ""}, "snippet": " code = _flatten_code(code)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4027_C8", "label": "if", "type": "if", "loc": [4027, 4034], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "vector": [4, 2, 0.9771, 0.0019, 2, 0.28, 0.8235, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not parsed.has_simple_start():\n # Get the first set, if possible.\n try:\n fs_code = _compile_firstset(info, parsed.get_firstset(reverse))\n fs_code = _flatten_code(fs_code)\n code = fs_code + code\n except _FirstSetError:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L4029_C12", "label": "try", "type": "try", "loc": [4029, 4034], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4027_C8", "vector": [7, 3, 0.9773, 0.0015, 3, 0.1, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n fs_code = _compile_firstset(info, parsed.get_firstset(reverse))\n fs_code = _flatten_code(fs_code)\n code = fs_code + code\n except _FirstSetError:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4030_C16", "label": "fs_code = _compile_firstset()", "type": "assigned_variable", "loc": [4030, 4030], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L4029_C12", "vector": [14, 4, 0.977, 0.0002, 4, 0.16, 0.0, 487, 3, 2, 0, 0, 346, 10, 2], "semantic": {"name": "fs_code", "arg_names": [], "import_names": [], "rhs_call_name": "_compile_firstset", "annotation": ""}, "snippet": " fs_code = _compile_firstset(info, parsed.get_firstset(reverse))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4031_C16", "label": "fs_code = _flatten_code()", "type": "assigned_variable", "loc": [4031, 4031], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L4029_C12", "vector": [14, 4, 0.9772, 0.0002, 4, 0.16, 0.5, 487, 3, 1, 0, 0, 863, 10, 1], "semantic": {"name": "fs_code", "arg_names": [], "import_names": [], "rhs_call_name": "_flatten_code", "annotation": ""}, "snippet": " fs_code = _flatten_code(fs_code)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4032_C16", "label": "code =", "type": "assigned_variable", "loc": [4032, 4032], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L4029_C12", "vector": [14, 4, 0.9775, 0.0002, 4, 0.16, 1.0, 44, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " code = fs_code + code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4037_C8", "label": "version =", "type": "assigned_variable", "loc": [4037, 4037], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "vector": [14, 2, 0.9787, 0.0002, 2, 0.28, 0.8824, 623, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4038_C8", "label": "if", "type": "if", "loc": [4038, 4039], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "vector": [4, 2, 0.979, 0.0005, 2, 0.28, 0.9412, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version not in (0, VERSION0, VERSION1):\n raise ValueError(\"VERSION0 and VERSION1 flags are mutually incompatible\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4047_C8", "label": "self.scanner = compile()", "type": "assigned_variable", "loc": [4047, 4049], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "vector": [14, 2, 0.9813, 0.0007, 2, 0.28, 1.0, 509, 3, 11, 0, 0, 821, 10, 2], "semantic": {"name": "self.scanner", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " self.scanner = _regex.compile(None, (flags & GLOBAL_FLAGS) | version,\n code, {}, {}, {}, [], req_offset, req_chars, req_flags,\n len(patterns))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L4051_C4", "label": "scan", "type": "function", "loc": [4051, 4071], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3979_C0", "vector": [2, 1, 0.9845, 0.0051, 1, 0.07, 1.0, 202, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "scan", "arg_names": ["self", "string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def scan(self, string):\n result = []\n append = result.append\n match = self.scanner.scanner(string).match\n i = 0\n while True:\n m = match()\n if not m:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4052_C8", "label": "result =", "type": "assigned_variable", "loc": [4052, 4052], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L4051_C4", "vector": [14, 2, 0.9823, 0.0002, 2, 0.4, 0.0, 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_1389:Assign_L4053_C8", "label": "append =", "type": "assigned_variable", "loc": [4053, 4053], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L4051_C4", "vector": [14, 2, 0.9825, 0.0002, 2, 0.4, 0.2, 243, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " append = result.append"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4054_C8", "label": "match =", "type": "assigned_variable", "loc": [4054, 4054], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L4051_C4", "vector": [14, 2, 0.9828, 0.0002, 2, 0.4, 0.4, 36, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "match", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " match = self.scanner.scanner(string).match"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4055_C8", "label": "i =", "type": "assigned_variable", "loc": [4055, 4055], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L4051_C4", "vector": [14, 2, 0.983, 0.0002, 2, 0.4, 0.6, 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_1389:While_L4056_C8", "label": "while", "type": "while", "loc": [4056, 4069], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L4051_C4", "vector": [5, 2, 0.9848, 0.0034, 2, 0.4, 0.8, 0, 1, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n m = match()\n if not m:\n break\n j = m.end()\n if i == j:\n break\n action = self.lexicon[m.lastindex - 1][1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4057_C12", "label": "m = match()", "type": "assigned_variable", "loc": [4057, 4057], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L4056_C8", "vector": [14, 3, 0.9835, 0.0002, 3, 0.46, 0.0, 711, 3, 0, 0, 0, 36, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " m = match()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4058_C12", "label": "if", "type": "if", "loc": [4058, 4059], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L4056_C8", "vector": [4, 3, 0.9839, 0.0005, 3, 0.46, 0.1429, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not m:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4060_C12", "label": "j = end()", "type": "assigned_variable", "loc": [4060, 4060], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L4056_C8", "vector": [14, 3, 0.9842, 0.0002, 3, 0.46, 0.2857, 100, 3, 0, 0, 0, 128, 10, 1], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "end", "annotation": ""}, "snippet": " j = m.end()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4061_C12", "label": "if", "type": "if", "loc": [4061, 4062], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L4056_C8", "vector": [4, 3, 0.9846, 0.0005, 3, 0.46, 0.4286, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i == j:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4063_C12", "label": "action =", "type": "assigned_variable", "loc": [4063, 4063], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L4056_C8", "vector": [14, 3, 0.985, 0.0002, 3, 0.46, 0.5714, 422, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "action", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " action = self.lexicon[m.lastindex - 1][1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4064_C12", "label": "if", "type": "if", "loc": [4064, 4066], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L4056_C8", "vector": [4, 3, 0.9855, 0.0007, 3, 0.46, 0.7143, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(action, '__call__'):\n self.match = m\n action = action(self, m.group())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4065_C16", "label": "self.match =", "type": "assigned_variable", "loc": [4065, 4065], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4064_C12", "vector": [14, 4, 0.9855, 0.0002, 4, 0.41, 0.0, 376, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.match", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.match = m"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4066_C16", "label": "action = action()", "type": "assigned_variable", "loc": [4066, 4066], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4064_C12", "vector": [14, 4, 0.9857, 0.0002, 4, 0.41, 1.0, 422, 3, 2, 0, 0, 422, 10, 2], "semantic": {"name": "action", "arg_names": [], "import_names": [], "rhs_call_name": "action", "annotation": ""}, "snippet": " action = action(self, m.group())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4067_C12", "label": "if", "type": "if", "loc": [4067, 4068], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L4056_C8", "vector": [4, 3, 0.9861, 0.0005, 3, 0.46, 0.8571, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if action is not None:\n append(action)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L4068_C16", "label": "append()", "type": "expression", "loc": [4068, 4068], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4067_C12", "vector": [8, 4, 0.9862, 0.0002, 4, 0.9, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " append(action)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4069_C12", "label": "i =", "type": "assigned_variable", "loc": [4069, 4069], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L4056_C8", "vector": [14, 3, 0.9864, 0.0002, 3, 0.46, 1.0, 826, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i = j"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L4071_C8", "label": "return", "type": "return", "loc": [4071, 4071], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L4051_C4", "vector": [13, 2, 0.9869, 0.0002, 2, 0.4, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result, string[i : ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4074_C0", "label": "PROPERTIES = get_properties()", "type": "assigned_variable", "loc": [4074, 4074], "level": 0, "parent": null, "vector": [14, 0, 0.9876, 0.0002, 0, 0.66, 0.9637, 942, 3, 0, 0, 0, 98, 10, 1], "semantic": {"name": "PROPERTIES", "arg_names": [], "import_names": [], "rhs_call_name": "get_properties", "annotation": ""}, "snippet": "PROPERTIES = _regex.get_properties()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4077_C0", "label": "PROPERTY_NAMES =", "type": "assigned_variable", "loc": [4077, 4077], "level": 0, "parent": null, "vector": [14, 0, 0.9884, 0.0002, 0, 0.66, 0.9689, 69, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "PROPERTY_NAMES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "PROPERTY_NAMES = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L4078_C0", "label": "for prop_name", "type": "for", "loc": [4078, 4085], "level": 0, "parent": null, "vector": [6, 0, 0.9895, 0.0019, 0, 0.66, 0.9741, 117, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "prop_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for prop_name, (prop_id, values) in PROPERTIES.items():\n name, prop_values = PROPERTY_NAMES.get(prop_id, (\"\", {}))\n name = max(name, prop_name, key=len)\n PROPERTY_NAMES[prop_id] = name, prop_values\n\n for val_name, val_id in values.items():\n prop_values[val_id] = max(prop_values.get(val_id, \"\"), val_name,\n key=len)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4079_C4", "label": "name, prop_values = get()", "type": "assigned_variable", "loc": [4079, 4079], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L4078_C0", "vector": [14, 1, 0.9888, 0.0002, 1, 0.72, 0.0, 219, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "name, prop_values", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " name, prop_values = PROPERTY_NAMES.get(prop_id, (\"\", {}))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4080_C4", "label": "name = max()", "type": "assigned_variable", "loc": [4080, 4080], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L4078_C0", "vector": [14, 1, 0.9891, 0.0002, 1, 0.72, 0.3333, 57, 3, 3, 0, 0, 442, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "max", "annotation": ""}, "snippet": " name = max(name, prop_name, key=len)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4081_C4", "label": "assign", "type": "assigned_variable", "loc": [4081, 4081], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L4078_C0", "vector": [14, 1, 0.9893, 0.0002, 1, 0.72, 0.6667, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " PROPERTY_NAMES[prop_id] = name, prop_values"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L4083_C4", "label": "for val_name, val_id", "type": "for", "loc": [4083, 4085], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L4078_C0", "vector": [6, 1, 0.9901, 0.0007, 1, 0.72, 1.0, 277, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "val_name, val_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for val_name, val_id in values.items():\n prop_values[val_id] = max(prop_values.get(val_id, \"\"), val_name,\n key=len)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4084_C8", "label": " = max()", "type": "assigned_variable", "loc": [4084, 4085], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L4083_C4", "vector": [14, 2, 0.9902, 0.0005, 2, 0.47, 0.0, 0, 3, 3, 0, 0, 442, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "max", "annotation": ""}, "snippet": " prop_values[val_id] = max(prop_values.get(val_id, \"\"), val_name,\n key=len)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4088_C0", "label": "CHARACTER_ESCAPES =", "type": "assigned_variable", "loc": [4088, 4096], "level": 0, "parent": null, "vector": [14, 0, 0.992, 0.0022, 0, 0.66, 0.9793, 671, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "CHARACTER_ESCAPES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "CHARACTER_ESCAPES = {\n \"a\": \"\\a\",\n \"b\": \"\\b\",\n \"f\": \"\\f\",\n \"n\": \"\\n\",\n \"r\": \"\\r\",\n \"t\": \"\\t\",\n \"v\": \"\\v\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4099_C0", "label": "CHARSET_ESCAPES =", "type": "assigned_variable", "loc": [4099, 4106], "level": 0, "parent": null, "vector": [14, 0, 0.9945, 0.0019, 0, 0.66, 0.9845, 468, 0, 0, 0, 0, 0, 6, 6], "semantic": {"name": "CHARSET_ESCAPES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "CHARSET_ESCAPES = {\n \"d\": lookup_property(None, \"Digit\", True),\n \"D\": lookup_property(None, \"Digit\", False),\n \"s\": lookup_property(None, \"Space\", True),\n \"S\": lookup_property(None, \"Space\", False),\n \"w\": lookup_property(None, \"Word\", True),\n \"W\": lookup_property(None, \"Word\", False),\n}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4109_C0", "label": "POSITION_ESCAPES =", "type": "assigned_variable", "loc": [4109, 4116], "level": 0, "parent": null, "vector": [14, 0, 0.997, 0.0019, 0, 0.66, 0.9896, 841, 0, 0, 0, 0, 0, 6, 6], "semantic": {"name": "POSITION_ESCAPES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "POSITION_ESCAPES = {\n \"A\": StartOfString(),\n \"b\": Boundary(),\n \"B\": Boundary(False),\n \"m\": StartOfWord(),\n \"M\": EndOfWord(),\n \"Z\": EndOfString(),\n}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4119_C0", "label": "WORD_POSITION_ESCAPES = dict()", "type": "assigned_variable", "loc": [4119, 4119], "level": 0, "parent": null, "vector": [14, 0, 0.9985, 0.0002, 0, 0.66, 0.9948, 386, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "WORD_POSITION_ESCAPES", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": "WORD_POSITION_ESCAPES = dict(POSITION_ESCAPES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L4120_C0", "label": "update()", "type": "expression", "loc": [4120, 4125], "level": 0, "parent": null, "vector": [8, 0, 0.9994, 0.0015, 0, 0.66, 1.0, 637, 3, 1, 0, 0, 0, 0, 5], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": "WORD_POSITION_ESCAPES.update({\n \"b\": DefaultBoundary(),\n \"B\": DefaultBoundary(False),\n \"m\": DefaultStartOfWord(),\n \"M\": DefaultEndOfWord(),\n})"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L37_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L220_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L221_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L237_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L239_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Import_L247_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L248_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L248_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L253_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L254_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L261_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L263_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L264_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L265_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L266_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L223_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L271_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L273_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L274_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L273_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L275_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L273_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L276_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L273_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L279_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L281_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L282_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L281_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L283_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L286_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L287_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L287_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L288_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L291_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L292_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L292_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L293_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L293_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L294_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L294_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L295_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L295_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L296_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L294_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L297_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L297_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L298_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L292_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L300_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L303_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L304_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L285_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L307_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L309_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L309_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L311_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L309_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L312_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L312_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L309_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L315_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L317_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L318_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L317_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L319_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L319_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L321_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L317_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L323_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L325_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L326_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L325_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L327_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L329_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L330_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L329_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L331_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L333_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L333_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L335_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L335_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L336_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L333_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L338_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L340_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L341_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L340_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L342_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L340_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L343_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L343_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L344_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L340_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L346_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L346_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L347_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L340_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L348_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L350_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L351_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L350_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L352_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L350_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L353_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L350_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L354_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L354_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L356_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L354_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L358_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L358_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L361_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L354_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L364_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L364_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L365_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L364_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L366_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L366_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L368_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L366_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L370_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L366_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L371_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L371_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L373_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L371_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L375_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L371_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L378_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L371_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L379_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L379_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L381_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L379_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L383_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L379_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L386_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L379_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L387_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L379_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L388_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L366_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L391_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L366_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L392_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L366_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L393_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L350_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L395_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L397_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L399_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L399_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L401_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L399_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L402_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L399_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L405_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L399_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L408_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L397_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L410_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L397_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L411_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L397_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L412_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L397_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L413_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L413_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L415_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L413_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L416_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L416_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L418_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L416_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L421_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L416_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L422_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L397_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L426_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L426_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L427_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L397_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L429_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L431_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L433_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L433_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L435_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L433_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L436_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L433_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L437_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L433_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L440_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L433_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L444_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L433_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L448_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L448_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L449_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L448_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L450_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L448_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L452_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L454_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L455_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L455_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L456_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L458_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L459_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L458_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L460_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L464_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L465_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L464_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L466_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L464_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L467_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L467_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L469_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L464_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L471_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L471_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L473_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L471_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L474_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L474_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L475_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L464_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L477_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L479_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L480_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L479_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L481_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L483_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L484_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L483_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L485_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L483_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L486_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L483_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L487_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L487_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L488_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L487_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L491_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L487_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L492_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L487_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L494_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L487_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L498_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L498_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L499_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L498_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L500_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L487_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L502_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L483_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L504_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L483_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L507_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L507_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L508_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L507_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L509_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L483_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L511_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L513_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L514_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L513_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L515_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L515_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L516_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L513_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L518_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L513_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L520_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L513_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L521_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L521_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L522_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L521_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L523_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L523_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L524_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L521_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L526_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L521_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L527_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L513_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L529_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L513_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L532_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L534_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L535_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L534_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L536_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L534_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L537_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L537_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L538_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L537_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L540_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L537_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L542_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L544_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L545_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L544_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L546_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L544_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L547_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L544_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L548_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L548_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L550_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L548_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L552_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L548_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L554_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L554_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L556_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L554_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L559_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L554_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L560_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L554_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L563_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L554_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L566_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L554_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L569_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L548_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L570_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L570_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L572_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L570_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L575_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L577_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L578_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L581_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L583_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L584_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L588_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L589_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L592_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L594_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L597_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L573_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L600_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L606_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L607_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L606_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L608_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L606_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L611_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L606_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L614_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L616_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L617_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L616_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L618_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L618_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L619_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L618_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L620_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L620_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L621_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L620_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L623_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L626_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L627_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L630_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L632_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L633_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L633_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L634_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L636_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L637_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L640_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L642_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L645_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L648_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L625_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L650_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L652_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L653_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L652_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L654_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L652_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L655_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L652_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L656_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L652_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L659_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L652_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L662_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L664_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L665_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L664_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L666_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L668_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L669_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L668_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L672_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L668_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L673_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L668_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L674_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L674_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L675_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L674_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L676_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L674_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L677_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L677_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L678_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L678_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L680_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L678_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L681_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L678_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L682_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L682_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L684_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L682_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L685_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L682_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L686_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L686_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L688_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L686_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L689_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L689_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L690_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L686_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L691_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L691_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L693_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L693_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L694_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L693_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L695_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L695_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L696_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L695_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L698_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L691_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L700_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L691_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L701_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L701_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L703_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L701_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L704_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L701_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L705_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L705_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L707_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L707_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L708_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L708_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L709_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L708_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L711_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L707_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L713_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L705_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L715_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L705_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L716_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L716_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L718_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L718_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L719_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L719_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L720_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L719_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L722_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L718_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L724_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L724_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L725_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L724_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L727_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L716_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L729_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L716_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L730_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L730_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L732_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L730_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L735_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L677_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L738_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L741_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L744_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L745_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L748_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L749_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L752_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L753_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L754_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L754_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L756_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L759_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L760_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L761_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L762_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L763_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L764_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L764_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L765_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L764_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L766_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L764_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L768_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L764_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L769_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L771_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L750_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L772_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L773_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L773_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L775_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L776_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L776_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L778_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L779_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L779_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L781_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L782_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L782_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L784_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L785_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L785_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L787_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L788_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L788_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L790_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L791_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L791_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L793_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L794_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L794_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L796_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L799_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L746_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L800_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L803_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L804_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L805_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L806_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L806_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L807_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L806_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L808_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L806_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L810_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L806_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L811_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L813_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L740_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L815_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L817_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L818_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L817_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L819_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L817_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L820_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L817_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L821_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L821_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L823_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L821_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L824_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L821_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L825_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L821_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L826_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L821_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L827_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L827_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L828_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L827_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L829_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L827_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L831_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L827_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L832_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L821_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L834_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L821_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L836_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L817_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L837_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L837_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L839_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L837_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L840_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L837_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L841_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L837_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L845_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L817_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L846_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L846_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L848_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L817_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L850_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L853_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L854_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L853_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L855_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L853_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L856_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L853_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L858_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L860_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L861_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L860_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L862_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L860_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L863_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L863_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L864_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L863_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L865_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L863_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L867_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L863_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L868_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L860_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L870_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L872_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L873_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L872_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L874_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L872_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L875_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L872_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L876_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L876_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L877_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L876_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L878_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L876_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L879_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L876_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L880_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L880_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L881_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L880_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L883_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L876_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L885_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L876_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L887_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L876_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L888_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L872_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L890_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L890_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L891_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L872_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L893_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L895_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L896_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L895_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L897_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L895_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L898_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L898_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L899_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L898_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L900_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L898_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L902_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L898_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L903_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L895_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L905_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L907_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L908_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L907_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L910_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L907_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L911_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L907_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L912_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L907_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L913_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L913_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L914_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L913_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L915_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L913_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L916_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L907_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L918_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L907_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L919_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L907_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L921_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L921_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L922_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L907_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L923_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L925_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L926_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L925_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L927_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L927_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L928_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L927_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L930_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L925_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L932_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L925_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L934_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L936_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L937_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L936_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L938_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L936_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L939_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L936_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L941_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L943_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L944_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L943_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L945_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L943_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L947_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L947_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L948_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L948_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L949_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L948_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L950_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L948_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L951_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L947_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L955_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L943_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L957_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L959_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L960_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L959_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L961_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L959_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L962_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L962_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L963_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L962_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L964_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L962_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L968_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L959_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L970_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L972_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L959_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L974_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L976_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L977_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L976_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L978_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L976_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L979_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L976_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L980_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L976_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L981_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L981_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L982_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L981_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L983_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L981_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L985_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L981_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L986_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L976_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L988_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L990_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L991_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L990_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L995_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L990_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L997_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L990_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1001_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L990_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1006_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L990_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1007_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L990_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1016_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1016_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1017_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L990_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1019_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1019_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1020_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1019_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1021_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1025_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1026_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1025_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1027_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1025_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1028_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1028_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1030_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1028_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1034_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1028_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1035_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1028_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1041_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1025_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1043_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1045_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1046_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1045_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1047_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1045_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1049_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1045_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1052_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1052_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1053_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1052_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1054_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1052_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1057_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1045_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1060_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1062_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1063_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1062_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1064_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1066_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1067_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1066_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1068_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1070_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1071_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1070_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1072_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1074_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1075_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1074_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1076_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1074_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1077_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1074_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1078_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1074_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1079_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1074_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1080_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1074_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1083_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1083_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1085_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1083_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1086_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1086_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1088_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1086_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1089_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1089_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1090_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1089_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1093_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1086_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1095_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1086_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1096_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1096_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1098_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1096_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1099_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1099_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1099_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1108_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1108_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1114_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1115_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1115_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1116_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1115_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1118_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1114_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1120_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1120_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1121_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1125_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1128_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1129_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1154_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1156_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1154_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1157_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1157_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1158_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1157_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1160_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1154_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1162_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1154_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1163_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1188_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1188_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1188_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1191_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1191_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1191_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1188_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1188_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1200_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1200_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1200_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1203_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1200_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1204_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1200_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1205_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1200_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1200_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1211_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1212_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1211_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1213_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1211_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1214_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1211_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1215_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1211_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1216_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1211_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1219_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1221_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1222_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1221_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1223_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1221_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1224_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1225_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1224_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1226_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1226_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1227_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1227_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1228_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1227_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1229_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1221_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1234_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1221_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1235_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1237_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1237_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1239_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1237_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1240_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1237_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1241_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1241_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1241_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1244_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1244_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1246_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1244_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1247_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1241_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1248_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1248_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1250_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1248_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1237_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1254_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1237_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1255_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1237_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1256_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1259_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1260_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1261_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1263_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1264_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1268_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1268_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1270_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1268_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1273_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1275_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1277_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1278_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1280_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1281_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1280_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1282_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1280_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1284_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1280_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1285_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1280_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1287_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1280_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1288_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1288_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1289_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1289_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1290_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1289_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1292_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1288_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1294_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1288_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1297_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1280_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1299_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1299_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1300_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1280_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1280_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1304_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1306_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1307_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1306_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1306_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1309_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1309_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1310_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1306_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1312_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1312_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1306_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1314_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1316_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1317_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1316_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1318_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1316_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1319_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1319_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1320_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1316_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1322_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1322_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1323_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1316_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1324_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1326_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1327_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1326_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1328_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1326_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1329_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1329_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1330_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1326_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1332_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1332_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1333_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1326_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1337_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1338_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1339_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1339_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1340_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1342_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1342_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1343_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1336_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1344_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1346_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1347_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1346_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1348_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1346_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1350_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1346_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1351_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1351_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1352_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1351_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1353_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1353_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1355_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1351_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1358_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1358_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1360_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1351_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1363_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1346_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1365_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1365_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1366_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1346_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1367_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1370_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1372_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1373_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1374_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1374_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1377_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1379_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1382_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1383_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1383_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1386_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1383_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1387_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1389_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1389_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1392_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1389_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1393_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1396_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1397_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1397_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1399_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1402_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1405_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1405_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1406_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1369_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1408_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1410_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1411_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1410_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1412_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1410_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1414_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1414_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1416_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1410_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1418_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1410_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1419_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1419_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1421_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1421_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1422_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1421_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1425_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1410_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1427_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1427_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1431_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1427_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1432_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1427_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1434_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1427_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1437_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1437_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1438_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1427_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1440_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1410_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1442_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1410_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1443_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1410_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1446_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1448_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1449_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1448_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1450_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1448_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1451_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1448_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1452_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1448_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1455_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1457_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1458_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1457_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1459_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1457_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1460_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1457_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1461_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1461_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1462_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1457_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1464_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1457_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1466_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1468_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1469_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1468_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1470_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1470_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1471_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1470_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1473_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1468_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1475_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1468_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1476_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1476_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1477_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1476_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1478_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1478_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1479_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1468_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1483_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1468_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1484_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1484_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1485_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1468_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1487_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1489_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1490_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1489_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1491_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1491_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1492_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1491_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1494_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1497_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1499_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1500_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1502_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1502_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1503_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1505_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1505_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1507_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1505_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1508_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1508_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1509_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1505_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1514_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1505_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1515_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1505_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1516_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1516_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1517_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1505_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1522_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1522_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1523_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1505_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1525_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1529_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1529_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1530_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1529_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1531_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1529_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1532_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1532_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1533_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1536_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1537_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1537_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1538_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1537_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1540_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1540_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1541_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1544_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1544_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1545_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1544_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1546_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1546_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1547_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1546_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1548_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1548_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1549_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1552_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1552_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1553_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1553_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1554_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1553_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1555_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1553_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1556_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1556_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1557_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1496_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1560_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1565_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1566_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1565_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1567_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1565_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1568_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1568_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1570_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1568_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1571_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1571_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1572_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1568_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1574_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1574_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1576_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1568_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1578_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1578_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1580_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1568_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1582_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1582_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1584_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1582_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1585_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1585_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1586_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1568_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1588_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1565_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1590_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1590_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1591_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1590_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1593_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1565_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1595_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1595_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1597_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1595_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1598_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1598_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1599_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1598_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1600_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L1598_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1601_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1601_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1602_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1595_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1606_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1565_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1608_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1608_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1611_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1608_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1612_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1608_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1613_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1608_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1614_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1614_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1616_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1614_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1617_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1614_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1618_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1618_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1620_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1608_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1623_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1608_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1624_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1565_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1626_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1626_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1628_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1565_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1630_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1565_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1635_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1637_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1638_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1637_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1639_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1637_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1640_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1640_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1641_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1640_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1642_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1640_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1644_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1637_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1646_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1648_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1649_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1648_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1650_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1648_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1651_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1651_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1652_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1651_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1654_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1654_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1655_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1655_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1656_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1655_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1657_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1648_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1662_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1648_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1663_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1665_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1666_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1665_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1667_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1665_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1668_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1665_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1670_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1665_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1671_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1671_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1672_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1671_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1673_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1671_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1676_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1665_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1678_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L1678_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1679_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1697_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1698_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1698_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1699_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1697_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1700_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1704_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1704_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1705_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1707_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1707_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1708_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1708_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1709_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1708_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1711_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1707_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1712_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1712_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1713_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1712_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1715_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1707_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1716_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1716_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1717_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1716_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1719_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1707_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1721_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1721_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1723_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1707_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1725_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1727_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1730_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1730_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1731_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1733_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1733_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1734_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1736_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1736_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1737_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1739_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1739_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1740_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1742_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1743_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1745_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1745_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1746_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1748_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1751_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1751_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1752_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1754_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1754_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1755_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1757_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1757_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1758_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1760_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1760_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1761_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1763_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1763_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1764_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1766_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1766_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1767_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1769_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1769_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1770_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1703_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1772_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1772_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1773_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1776_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1777_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1777_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1778_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1777_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1779_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1777_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1781_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1776_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1783_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1783_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1784_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1776_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1786_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1786_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1787_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1786_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1788_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1786_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1790_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1786_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1792_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1786_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1794_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1776_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1796_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1796_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1797_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1776_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1800_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1800_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1801_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1803_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1804_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1803_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1805_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1803_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1807_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1807_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1808_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1803_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1810_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1810_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1811_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1810_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1812_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1810_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1814_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1803_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1816_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1816_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1817_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1803_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1819_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1819_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1820_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1822_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1823_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1822_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1824_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1826_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1827_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1826_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1828_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1831_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1831_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1832_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1831_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1833_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1835_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1835_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1836_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1838_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1838_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1839_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1838_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1841_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1841_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1842_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1838_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1843_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1845_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1845_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1846_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1845_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1847_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1849_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1849_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1850_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1849_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1851_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1853_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1853_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1854_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1856_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1856_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1857_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1859_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1859_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1860_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1862_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1862_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1863_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1865_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1865_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1866_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1869_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1869_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1870_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1869_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1871_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1873_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1873_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1874_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1876_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1876_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1877_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1880_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1880_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1881_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1830_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1883_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1883_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1884_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1886_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1887_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1886_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1888_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1891_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1891_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1892_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1891_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1893_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1895_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1895_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1896_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1896_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1897_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1899_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1899_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1901_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1899_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1904_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1899_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1905_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1899_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1910_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1899_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1913_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1899_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1915_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1915_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1916_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1915_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1918_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1899_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1920_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1922_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1922_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1924_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1922_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1927_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1922_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1929_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1929_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1930_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1929_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1932_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1922_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1934_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1936_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1936_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1937_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1936_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1938_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1940_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1940_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1941_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1940_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1942_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1944_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1944_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1945_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1947_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1947_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1948_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1950_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1950_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1951_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1953_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1953_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1954_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1953_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1955_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1953_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1958_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1960_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1960_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1961_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1960_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1962_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1962_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1963_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1962_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1964_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1960_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1966_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1960_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1968_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1970_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1971_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1972_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1973_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1973_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1974_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1973_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1975_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1978_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1978_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1980_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1978_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1981_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1981_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1982_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1981_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1983_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1983_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1984_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1983_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1986_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1978_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L1988_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L1994_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1995_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L1995_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1996_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1996_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1997_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L1996_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L1999_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2002_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2005_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2006_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2007_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L2008_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2011_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2013_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2013_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2016_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2013_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L2017_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2022_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2022_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2023_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2026_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2027_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2027_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2028_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L1991_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2030_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2036_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2037_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2037_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2038_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2038_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2039_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2038_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2041_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2044_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2047_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2048_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2049_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L2050_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2053_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2055_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2055_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L2058_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2063_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2063_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2064_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2067_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2068_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2068_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2069_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2033_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2071_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2074_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2074_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2076_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2076_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2077_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2074_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2079_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2079_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2080_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2074_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2083_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2083_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2084_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2074_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2087_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2087_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2089_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2074_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2092_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2092_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2094_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2074_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2096_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2099_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2099_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2099_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2103_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2104_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2099_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2106_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2099_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2110_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2099_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2114_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2116_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2099_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2099_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2133_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2134_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2134_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2136_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2134_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2137_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2134_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2138_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2138_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2141_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2138_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2142_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2138_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2144_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2138_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2146_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2163_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2163_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2165_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2165_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2167_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2165_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2170_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2163_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2172_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2163_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2174_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2163_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2177_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2186_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2186_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2187_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2189_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2191_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2191_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2192_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2191_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2194_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2191_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2195_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2191_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2196_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2196_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2197_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2197_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2198_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2197_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2199_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2199_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2200_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2199_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2201_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2191_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2203_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2191_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2204_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2207_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2210_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2210_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2212_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2213_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2210_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2215_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2215_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2216_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2215_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2218_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2210_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2220_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2210_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2222_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2225_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2226_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2226_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2227_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2225_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2229_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2225_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2230_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2234_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2235_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2236_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2238_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2238_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2239_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2239_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2241_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2244_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2249_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2250_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2250_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2251_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2253_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2255_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2255_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2256_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2258_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2258_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L1890_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2261_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2261_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2262_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2265_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2265_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2265_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2267_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2265_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2268_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2265_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2269_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2265_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2273_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2274_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2274_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2275_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2274_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2277_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2277_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2278_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2282_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2285_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2288_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2290_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2292_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2295_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2296_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2298_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2298_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2299_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2301_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2301_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2302_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2304_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2304_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2305_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2314_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2314_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2316_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2314_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2317_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2314_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2318_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2314_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2319_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2314_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2320_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2314_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2322_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2322_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2324_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2322_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2326_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2314_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2328_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2331_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2331_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2332_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2335_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2337_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2337_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2338_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2340_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2340_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2341_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2343_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2343_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2344_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2343_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2345_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2343_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2347_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2343_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2349_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2343_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2352_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2343_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2355_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2355_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2357_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2343_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2360_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2362_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2362_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2363_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2362_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2364_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2367_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2367_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2368_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2370_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2370_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2371_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2373_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2373_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2374_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2374_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2375_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2373_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2377_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2373_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2379_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2382_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2383_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2384_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2385_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2386_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2387_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2388_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2390_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2391_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2391_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2392_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2391_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2394_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L2394_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2395_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2399_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2402_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2403_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2405_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2405_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2406_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2405_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2407_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2405_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2409_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2411_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2411_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2412_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2411_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2413_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2411_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2414_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2416_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2416_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2417_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2416_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2418_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2420_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2420_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2421_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2423_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2423_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2424_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2426_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2426_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2427_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2429_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2429_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2430_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2433_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2433_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2434_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2433_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2435_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2433_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2436_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2433_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2437_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2437_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2438_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2437_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2439_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2433_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2441_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2433_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2443_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2445_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2445_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2446_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2445_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2447_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2445_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2448_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2448_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2449_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2448_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2450_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2452_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2452_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2453_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2455_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2455_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2456_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2381_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2459_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2459_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2460_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2462_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2463_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2462_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2464_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2466_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2467_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2466_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2468_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2470_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2471_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2470_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2472_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2474_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2475_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2474_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2476_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2478_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2479_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2478_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2480_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2482_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2483_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2482_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2484_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2486_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2487_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2486_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2488_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2490_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2491_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2490_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2492_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2494_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2495_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2494_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2496_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2499_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2499_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2500_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2499_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2501_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2501_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2502_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2499_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2503_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2499_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2504_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2499_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2508_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2508_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2509_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2509_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2510_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2510_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2511_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2499_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2515_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2515_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2516_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2516_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2517_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2515_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2519_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2519_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2520_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2499_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2523_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2499_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2527_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2527_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2528_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2528_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2529_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2527_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2531_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2534_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2535_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2537_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2537_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2538_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2537_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2539_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2541_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2541_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2542_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2541_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2543_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2545_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2545_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2546_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2548_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2548_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2549_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2551_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2551_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2553_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2551_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2554_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2554_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2555_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2554_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2556_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2554_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2557_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2551_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2560_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2560_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2561_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2551_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2564_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2551_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2565_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2551_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2567_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2551_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2568_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2551_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2571_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2574_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2574_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2575_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2574_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2576_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2576_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2577_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2574_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2578_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2574_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2579_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2581_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2581_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2582_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2584_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2584_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2585_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2588_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2588_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2589_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2498_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2591_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2591_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2592_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2591_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2594_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2594_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2595_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2594_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2596_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2594_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2599_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2594_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2601_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2601_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2602_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2594_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2606_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2594_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2609_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2591_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2611_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2591_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2612_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2612_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2613_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2612_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2614_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2614_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2615_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2591_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2617_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2591_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2618_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2618_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2619_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2618_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2620_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2591_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2622_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2624_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2625_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2625_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2628_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2625_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2630_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2625_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2632_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2624_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2634_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2634_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2635_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2624_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2637_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2637_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2638_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2641_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2642_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2644_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2644_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2645_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2644_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2646_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2644_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2647_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2644_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2648_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2650_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2650_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2651_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2653_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2653_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2654_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2653_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2656_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2658_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2658_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2659_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2658_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2660_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2662_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2662_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2663_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2662_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2664_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2666_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2666_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2667_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2669_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2669_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2670_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2672_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2672_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2673_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2672_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2674_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2674_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2675_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2672_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2677_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2679_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2679_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2680_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2679_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2681_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2681_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2682_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2681_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2684_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2679_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2686_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2679_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2687_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2687_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2688_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2679_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2690_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2692_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2692_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2693_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2693_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2694_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2693_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2696_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2692_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2697_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2692_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2700_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2702_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2702_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2703_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2705_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2705_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2706_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2710_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2710_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2711_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2711_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2712_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2710_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2714_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2640_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2716_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2716_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2717_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2716_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2718_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2718_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2719_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2718_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2720_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2716_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2722_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2716_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2723_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2723_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2724_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2716_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2726_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2716_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2727_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2730_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2730_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2731_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2730_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2732_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2730_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2733_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2730_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2734_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2730_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2736_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2738_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2738_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2739_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2738_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2740_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2742_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2743_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2745_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2747_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2747_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2748_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2747_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2749_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2751_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2751_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2752_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2754_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2754_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2755_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2757_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2757_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2758_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2760_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2760_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2761_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2763_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2763_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2764_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2766_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2766_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2767_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2769_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2769_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2770_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2769_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2772_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2769_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2773_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2769_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2774_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2769_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2777_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2769_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2778_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2778_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2779_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2778_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2780_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2769_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2785_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2769_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2788_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2790_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2790_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2791_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2790_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2792_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2792_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2793_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2790_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2794_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2790_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2795_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2797_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2797_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2798_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2801_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2801_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2802_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2729_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2804_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2804_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2805_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2807_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2808_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2807_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2809_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2812_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2814_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2814_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2815_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2815_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2816_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2814_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2818_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2820_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2820_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2821_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2820_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2822_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2820_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2823_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2820_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2824_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2826_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2826_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2827_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2829_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2829_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2830_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2829_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2832_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2834_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2834_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2835_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2834_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2836_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2838_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2838_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2839_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2841_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2841_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2842_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2844_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2844_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2845_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2847_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2847_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2848_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2850_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2850_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2851_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2854_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2854_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2855_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2854_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2857_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2859_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2859_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2860_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2862_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2862_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2863_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2811_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2866_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2866_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2867_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2869_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2870_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2870_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2871_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2869_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2873_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2873_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2874_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2877_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2883_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2883_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2885_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2883_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2886_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2883_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2887_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2883_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2888_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2883_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2889_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2883_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2891_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2894_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2894_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2895_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2897_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2897_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2898_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2900_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2900_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2901_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2903_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2903_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2904_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2906_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2906_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2907_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2906_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2908_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2906_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2910_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2906_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2912_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2906_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2914_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2916_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2916_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2917_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2916_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2918_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2916_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2919_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2922_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2922_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2923_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2876_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2925_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2925_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2926_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2928_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2929_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2928_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2933_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2928_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2935_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2935_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2937_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2935_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2938_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2935_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2939_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2935_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2940_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2935_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2941_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2935_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2942_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2935_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2944_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2928_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2947_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2947_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2948_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2928_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2950_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2950_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2952_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2952_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2953_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2950_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2956_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2956_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2958_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2950_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2961_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2950_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2964_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2950_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2965_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L2965_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2966_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2966_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2967_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2966_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2968_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2950_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2971_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2971_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2973_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2950_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2975_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2975_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2977_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2950_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2979_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2928_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2981_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2981_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2982_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2981_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2983_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2981_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2985_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2981_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L2987_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2981_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L2989_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2928_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2992_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2992_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2993_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2992_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L2994_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2992_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L2995_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2928_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2999_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L2999_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3000_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L2928_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3002_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3002_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3003_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3005_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3006_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3005_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3012_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3012_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3013_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3012_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3014_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3012_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3015_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3012_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3016_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3012_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3017_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3012_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3019_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3005_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3021_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3021_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3022_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3022_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3023_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3022_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3025_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3025_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3026_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3021_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3030_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3021_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3033_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3005_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3035_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3005_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3038_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3038_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3039_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3038_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3040_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3038_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3042_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3005_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3044_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3044_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3045_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3005_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3048_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3048_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3049_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3051_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3052_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3051_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3053_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3056_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3056_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3057_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3056_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3058_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3058_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3059_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3056_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3061_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3063_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3063_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3064_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3064_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3065_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3067_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3067_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3069_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3067_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3070_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3070_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3071_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3070_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3072_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3072_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3073_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3072_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3075_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3067_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3077_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3079_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3079_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3080_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3079_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3081_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3079_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3082_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3079_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3083_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3079_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3084_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3084_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3085_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3085_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3086_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3086_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3089_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3089_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3090_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3089_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3093_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3085_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3095_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3085_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3096_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3096_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3097_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3097_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3100_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3100_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3102_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3100_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3105_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3096_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3107_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3096_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3109_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3096_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3111_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3079_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3079_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3133_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3134_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3135_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3137_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3137_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3138_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3135_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3139_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3143_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3148_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3149_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3152_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3158_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3159_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3163_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3164_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3167_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3168_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3168_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3169_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3171_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3172_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3171_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3174_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3055_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3187_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3189_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3190_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3194_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3195_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3194_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3197_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3197_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3198_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3203_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3203_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3205_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3203_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3203_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3207_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3203_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3208_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3203_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3203_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3203_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3203_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3214_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3221_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3221_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3222_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3224_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3225_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3229_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3231_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3233_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3236_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3236_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3237_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3239_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3243_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3244_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3243_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3246_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3246_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3247_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3249_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3249_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3251_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3252_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3249_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3255_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3255_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3258_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3249_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3249_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3264_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3249_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3249_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3267_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3267_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3268_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3267_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3269_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3269_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3270_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3269_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3272_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3249_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3274_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3274_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3276_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3249_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3278_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3280_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3282_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3282_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3283_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3286_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3286_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3288_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3291_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3294_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3295_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3295_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3296_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3296_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3297_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3296_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3298_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3300_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3300_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3301_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3303_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3305_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3306_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3305_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3311_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3305_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3313_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3313_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3314_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3313_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3315_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3315_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3316_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3313_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3318_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3318_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3319_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3313_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3322_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3313_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3324_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3305_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3326_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3327_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3328_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3330_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3331_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3330_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3336_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3330_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3338_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3338_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3339_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3338_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3340_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3340_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3341_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3340_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3342_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3342_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3344_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3342_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3346_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3338_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3348_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3348_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3349_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3338_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3352_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3338_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3354_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3330_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3356_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3356_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3357_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3356_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3358_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3360_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3361_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3360_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3366_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3360_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3368_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3368_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3369_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3368_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3370_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3370_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3371_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3370_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3372_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3372_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3374_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3372_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3376_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3368_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3378_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3378_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3379_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3368_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3382_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3368_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3384_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3360_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3386_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3386_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3387_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3386_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3388_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3388_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3389_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3386_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3391_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3393_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3394_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3393_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3399_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3393_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3401_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3401_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3402_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3401_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3403_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3403_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3404_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3403_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3405_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3405_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3407_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3405_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3409_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3401_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3411_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3411_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3412_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3411_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3413_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3401_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3417_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3401_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3419_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3393_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3422_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3423_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3425_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3427_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3430_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3431_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3431_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3432_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3432_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3433_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3432_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3435_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3437_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3439_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3439_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3440_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3439_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3441_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3439_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3443_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3443_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3444_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3443_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3446_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3448_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3448_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3449_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3451_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3421_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3453_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3393_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3455_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3455_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3456_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3455_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3457_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3459_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3460_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3459_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3461_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3463_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3464_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3463_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3465_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3467_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3468_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3467_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3469_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3471_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3472_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3471_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3473_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3475_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3476_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3475_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3482_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3482_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3483_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3482_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3484_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3482_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3486_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3486_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3487_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3486_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3488_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3488_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3489_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3488_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3490_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3486_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3492_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3482_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3494_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3482_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3495_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3482_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3497_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3475_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3499_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3499_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3500_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3500_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3501_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3500_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3503_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3499_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3504_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3475_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3507_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3507_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3508_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3475_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3510_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3510_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3511_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3510_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3512_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3510_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3514_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3510_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3516_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3475_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3519_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3519_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3520_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3519_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3521_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3475_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3524_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3524_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3525_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3475_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3527_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3527_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3528_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3530_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3531_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3531_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3532_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3532_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3533_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3532_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3534_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3537_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3538_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3537_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3544_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3544_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3545_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3544_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3546_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3544_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3547_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3544_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3549_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3544_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3551_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3544_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3552_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3552_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3553_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3537_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3555_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3555_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3556_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3555_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3557_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3555_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3559_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3555_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3561_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3561_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3562_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3555_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3564_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3555_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3565_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3555_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3568_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3571_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3573_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3574_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3574_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3575_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3578_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3578_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3579_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3578_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3581_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3582_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3584_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3586_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3587_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3567_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3588_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3537_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3591_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3591_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3592_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3537_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3595_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3595_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3596_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3596_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3597_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3596_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3599_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3537_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3601_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3601_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3603_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3603_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3604_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3604_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3605_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3603_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3606_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3606_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3607_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3606_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3609_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3609_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3610_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3606_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3612_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3606_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3613_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3606_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3616_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3616_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3617_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3606_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3620_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3537_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3622_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3622_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3623_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3623_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3624_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3622_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3626_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3626_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3627_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3626_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3628_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3626_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3631_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3633_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3634_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3633_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3635_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3635_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3636_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3636_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3637_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3636_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3638_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3636_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3640_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3636_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3641_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3635_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3643_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3635_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3644_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3635_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3645_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3633_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3647_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3648_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3649_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3651_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3651_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3652_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3652_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3653_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3653_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3654_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3654_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3657_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3657_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3659_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3651_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3663_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3651_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3664_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3651_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3665_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3651_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3668_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3651_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3669_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3651_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3672_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3651_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3673_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3633_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3675_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3675_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3676_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3675_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3677_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3675_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3679_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3679_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3680_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3680_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3681_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3680_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3683_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3683_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3684_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3684_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3685_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3685_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3688_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3688_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3690_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3683_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3694_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3680_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3697_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3680_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3699_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3679_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3702_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3679_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3703_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3679_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3706_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3679_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3707_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3679_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3710_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3679_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3711_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3633_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3713_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3713_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3714_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3713_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3715_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3713_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3717_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3717_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3718_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3718_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3719_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3718_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3721_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3721_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3722_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3722_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3725_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3725_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3727_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3725_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3728_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3728_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3729_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3718_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3734_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3718_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3737_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3718_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3740_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3717_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3742_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3717_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3744_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3744_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3745_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3744_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3748_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3744_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3750_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3744_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3752_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3744_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3755_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3744_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3757_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3744_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3759_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3633_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3761_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3761_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3762_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3761_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3763_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3761_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3765_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3765_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3766_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3766_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3767_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3767_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3768_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3768_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3771_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3771_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3773_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3771_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3774_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3766_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3779_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3765_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3782_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3765_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3785_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3765_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3788_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3633_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3790_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3790_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3791_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3790_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3792_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3790_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3794_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3794_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3795_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3795_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3796_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3796_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3797_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3797_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3798_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3798_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3801_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3801_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3803_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3796_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3807_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3807_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3808_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3795_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3812_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3795_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3814_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3795_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3817_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3795_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3820_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3794_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3822_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3822_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3823_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3794_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3825_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3794_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3827_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3633_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3829_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3829_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3830_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3633_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3833_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3833_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3834_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3833_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3835_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3833_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3837_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3837_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3838_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3838_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3839_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3839_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3840_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3840_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3842_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3842_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3843_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3837_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3847_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3837_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3850_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L3837_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3853_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3855_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3856_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3855_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3860_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3861_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3862_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3864_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3866_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3867_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3868_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3869_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3870_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3871_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3872_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3873_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3874_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3875_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3855_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3877_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3877_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3878_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3877_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3879_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3879_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3880_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L3880_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3882_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3879_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3885_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3879_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3886_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3886_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3887_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3886_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3888_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3877_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3890_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3890_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3894_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3890_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3895_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3890_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3896_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3877_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3898_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3877_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3899_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3877_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3901_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3855_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3903_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3903_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3904_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3855_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3906_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3906_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3909_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3906_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3910_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3910_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3911_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3906_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3913_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3913_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3914_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3913_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3916_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3906_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3918_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3920_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3921_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3920_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3924_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3920_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3925_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3920_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3926_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3926_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3928_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3926_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3929_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3926_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3930_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3930_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3932_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3932_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3934_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3932_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3935_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3932_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3936_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3936_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3940_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3932_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3943_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3932_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3944_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3932_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3945_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3945_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3948_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3930_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3950_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3930_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3951_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3926_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3953_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3920_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3955_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3920_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3956_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3958_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3959_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3958_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3961_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3958_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3962_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3962_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3963_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3962_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3964_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3964_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3965_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3962_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3967_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3962_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3968_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3962_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3971_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3962_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3973_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3962_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3974_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3962_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3975_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3958_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L3977_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3979_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3981_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3984_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3985_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3985_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3987_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3985_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3988_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3985_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3989_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3985_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3990_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3985_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L3991_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L3985_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L3995_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3998_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L3999_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4000_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4003_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4004_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4007_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L4011_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4015_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4019_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4022_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4025_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4027_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4027_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L4029_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L4029_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4030_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L4029_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4031_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:Try_L4029_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4032_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4037_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4038_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L3980_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4047_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:ClassDef_L3979_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L4051_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L4051_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4052_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L4051_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4053_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L4051_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4054_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L4051_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4055_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L4051_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L4056_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L4056_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4057_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L4056_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4058_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L4056_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4060_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L4056_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4061_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L4056_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4063_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L4056_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4064_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4064_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4065_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4064_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4066_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L4056_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4067_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:If_L4067_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Expr_L4068_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:While_L4056_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4069_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:FunctionDef_L4051_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Return_L4071_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L4078_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4079_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L4078_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4080_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L4078_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4081_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L4078_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L4083_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1389:For_L4083_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1389:Assign_L4084_C8"}] |
#
# Secret Labs' Regular Expression Engine
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# This version of the SRE library can be redistributed under CNRI's
# Python 1.6 license. For any other use, please contact Secret Labs
# AB (info@pythonware.com).
#
# Portions of this engine have been developed in cooperation with
# CNRI. Hewlett-Packard provided funding for 1.6 integration and
# other compatibility work.
#
# 2010-01-16 mrab Python front-end re-written and extended
r"""Support for regular expressions (RE).
This module provides regular expression matching operations similar to those
found in Perl. It supports both 8-bit and Unicode strings; both the pattern and
the strings being processed can contain null bytes and characters outside the
US ASCII range.
Regular expressions can contain both special and ordinary characters. Most
ordinary characters, like "A", "a", or "0", are the simplest regular
expressions; they simply match themselves. You can concatenate ordinary
characters, so last matches the string 'last'.
There are a few differences between the old (legacy) behaviour and the new
(enhanced) behaviour, which are indicated by VERSION0 or VERSION1.
The special characters are:
"." Matches any character except a newline.
"^" Matches the start of the string.
"$" Matches the end of the string or just before the
newline at the end of the string.
"*" Matches 0 or more (greedy) repetitions of the preceding
RE. Greedy means that it will match as many repetitions
as possible.
"+" Matches 1 or more (greedy) repetitions of the preceding
RE.
"?" Matches 0 or 1 (greedy) of the preceding RE.
*?,+?,?? Non-greedy versions of the previous three special
characters.
*+,++,?+ Possessive versions of the previous three special
characters.
{m,n} Matches from m to n repetitions of the preceding RE.
{m,n}? Non-greedy version of the above.
{m,n}+ Possessive version of the above.
{...} Fuzzy matching constraints.
"\\" Either escapes special characters or signals a special
sequence.
[...] Indicates a set of characters. A "^" as the first
character indicates a complementing set.
"|" A|B, creates an RE that will match either A or B.
(...) Matches the RE inside the parentheses. The contents are
captured and can be retrieved or matched later in the
string.
(?flags-flags) VERSION1: Sets/clears the flags for the remainder of
the group or pattern; VERSION0: Sets the flags for the
entire pattern.
(?:...) Non-capturing version of regular parentheses.
(?>...) Atomic non-capturing version of regular parentheses.
(?flags-flags:...) Non-capturing version of regular parentheses with local
flags.
(?P<name>...) The substring matched by the group is accessible by
name.
(?<name>...) The substring matched by the group is accessible by
name.
(?P=name) Matches the text matched earlier by the group named
name.
(?#...) A comment; ignored.
(?=...) Matches if ... matches next, but doesn't consume the
string.
(?!...) Matches if ... doesn't match next.
(?<=...) Matches if preceded by ....
(?<!...) Matches if not preceded by ....
(?(id)yes|no) Matches yes pattern if group id matched, the (optional)
no pattern otherwise.
(?|...|...) (?|A|B), creates an RE that will match either A or B,
but reuses capture group numbers across the
alternatives.
The fuzzy matching constraints are: "i" to permit insertions, "d" to permit
deletions, "s" to permit substitutions, "e" to permit any of these. Limits are
optional with "<=" and "<". If any type of error is provided then any type not
provided is not permitted.
A cost equation may be provided.
Examples:
(?:fuzzy){i<=2}
(?:fuzzy){i<=1,s<=2,d<=1,1i+1s+1d<3}
VERSION1: Set operators are supported, and a set can include nested sets. The
set operators, in order of increasing precedence, are:
|| Set union ("x||y" means "x or y").
~~ (double tilde) Symmetric set difference ("x~~y" means "x or y, but not
both").
&& Set intersection ("x&&y" means "x and y").
-- (double dash) Set difference ("x--y" means "x but not y").
Implicit union, ie, simple juxtaposition like in [ab], has the highest
precedence.
VERSION0 and VERSION1:
The special sequences consist of "\\" and a character from the list below. If
the ordinary character is not on the list, then the resulting RE will match the
second character.
\number Matches the contents of the group of the same number if
number is no more than 2 digits, otherwise the character
with the 3-digit octal code.
\a Matches the bell character.
\A Matches only at the start of the string.
\b Matches the empty string, but only at the start or end of a
word.
\B Matches the empty string, but not at the start or end of a
word.
\d Matches any decimal digit; equivalent to the set [0-9] when
matching a bytestring or a Unicode string with the ASCII
flag, or the whole range of Unicode digits when matching a
Unicode string.
\D Matches any non-digit character; equivalent to [^\d].
\f Matches the formfeed character.
\g<name> Matches the text matched by the group named name.
\G Matches the empty string, but only at the position where
the search started.
\L<name> Named list. The list is provided as a keyword argument.
\m Matches the empty string, but only at the start of a word.
\M Matches the empty string, but only at the end of a word.
\n Matches the newline character.
\N{name} Matches the named character.
\p{name=value} Matches the character if its property has the specified
value.
\P{name=value} Matches the character if its property hasn't the specified
value.
\r Matches the carriage-return character.
\s Matches any whitespace character; equivalent to
[ \t\n\r\f\v].
\S Matches any non-whitespace character; equivalent to [^\s].
\t Matches the tab character.
\uXXXX Matches the Unicode codepoint with 4-digit hex code XXXX.
\UXXXXXXXX Matches the Unicode codepoint with 8-digit hex code
XXXXXXXX.
\v Matches the vertical tab character.
\w Matches any alphanumeric character; equivalent to
[a-zA-Z0-9_] when matching a bytestring or a Unicode string
with the ASCII flag, or the whole range of Unicode
alphanumeric characters (letters plus digits plus
underscore) when matching a Unicode string. With LOCALE, it
will match the set [0-9_] plus characters defined as
letters for the current locale.
\W Matches the complement of \w; equivalent to [^\w].
\xXX Matches the character with 2-digit hex code XX.
\X Matches a grapheme.
\Z Matches only at the end of the string.
\\ Matches a literal backslash.
This module exports the following functions:
match Match a regular expression pattern at the beginning of a string.
fullmatch Match a regular expression pattern against all of a string.
search Search a string for the presence of a pattern.
sub Substitute occurrences of a pattern found in a string using a
template string.
subf Substitute occurrences of a pattern found in a string using a
format string.
subn Same as sub, but also return the number of substitutions made.
subfn Same as subf, but also return the number of substitutions made.
split Split a string by the occurrences of a pattern. VERSION1: will
split at zero-width match; VERSION0: won't split at zero-width
match.
splititer Return an iterator yielding the parts of a split string.
findall Find all occurrences of a pattern in a string.
finditer Return an iterator yielding a match object for each match.
compile Compile a pattern into a Pattern object.
purge Clear the regular expression cache.
escape Backslash all non-alphanumerics or special characters in a
string.
Most of the functions support a concurrent parameter: if True, the GIL will be
released during matching, allowing other Python threads to run concurrently. If
the string changes during matching, the behaviour is undefined. This parameter
is not needed when working on the builtin (immutable) string classes.
Some of the functions in this module take flags as optional parameters. Most of
these flags can also be set within an RE:
A a ASCII Make \w, \W, \b, \B, \d, and \D match the
corresponding ASCII character categories. Default
when matching a bytestring.
B b BESTMATCH Find the best fuzzy match (default is first).
D DEBUG Print the parsed pattern.
F f FULLCASE Use full case-folding when performing
case-insensitive matching in Unicode.
I i IGNORECASE Perform case-insensitive matching.
L L LOCALE Make \w, \W, \b, \B, \d, and \D dependent on the
current locale. (One byte per character only.)
M m MULTILINE "^" matches the beginning of lines (after a newline)
as well as the string. "$" matches the end of lines
(before a newline) as well as the end of the string.
E e ENHANCEMATCH Attempt to improve the fit after finding the first
fuzzy match.
R r REVERSE Searches backwards.
S s DOTALL "." matches any character at all, including the
newline.
U u UNICODE Make \w, \W, \b, \B, \d, and \D dependent on the
Unicode locale. Default when matching a Unicode
string.
V0 V0 VERSION0 Turn on the old legacy behaviour.
V1 V1 VERSION1 Turn on the new enhanced behaviour. This flag
includes the FULLCASE flag.
W w WORD Make \b and \B work with default Unicode word breaks
and make ".", "^" and "$" work with Unicode line
breaks.
X x VERBOSE Ignore whitespace and comments for nicer looking REs.
This module also defines an exception 'error'.
"""
# Public symbols.
__all__ = ["compile", "escape", "findall", "finditer", "fullmatch", "match",
"purge", "search", "split", "splititer", "sub", "subf", "subfn", "subn",
"template", "Scanner", "A", "ASCII", "B", "BESTMATCH", "D", "DEBUG", "E",
"ENHANCEMATCH", "S", "DOTALL", "F", "FULLCASE", "I", "IGNORECASE", "L",
"LOCALE", "M", "MULTILINE", "R", "REVERSE", "T", "TEMPLATE", "U", "UNICODE",
"V0", "VERSION0", "V1", "VERSION1", "X", "VERBOSE", "W", "WORD", "error",
"Regex"]
__version__ = "2.4.58"
# --------------------------------------------------------------------
# Public interface.
def match(pattern, string, flags=0, pos=None, endpos=None, partial=False,
concurrent=None, **kwargs):
"""Try to apply the pattern at the start of the string, returning a match
object, or None if no match was found."""
return _compile(pattern, flags, kwargs).match(string, pos, endpos,
concurrent, partial)
def fullmatch(pattern, string, flags=0, pos=None, endpos=None, partial=False,
concurrent=None, **kwargs):
"""Try to apply the pattern against all of the string, returning a match
object, or None if no match was found."""
return _compile(pattern, flags, kwargs).fullmatch(string, pos, endpos,
concurrent, partial)
def search(pattern, string, flags=0, pos=None, endpos=None, partial=False,
concurrent=None, **kwargs):
"""Search through string looking for a match to the pattern, returning a
match object, or None if no match was found."""
return _compile(pattern, flags, kwargs).search(string, pos, endpos,
concurrent, partial)
def sub(pattern, repl, string, count=0, flags=0, pos=None, endpos=None,
concurrent=None, **kwargs):
"""Return the string obtained by replacing the leftmost (or rightmost with a
reverse pattern) non-overlapping occurrences of the pattern in string by the
replacement repl. repl can be either a string or a callable; if a string,
backslash escapes in it are processed; if a callable, it's passed the match
object and must return a replacement string to be used."""
return _compile(pattern, flags, kwargs).sub(repl, string, count, pos,
endpos, concurrent)
def subf(pattern, format, string, count=0, flags=0, pos=None, endpos=None,
concurrent=None, **kwargs):
"""Return the string obtained by replacing the leftmost (or rightmost with a
reverse pattern) non-overlapping occurrences of the pattern in string by the
replacement format. format can be either a string or a callable; if a string,
it's treated as a format string; if a callable, it's passed the match object
and must return a replacement string to be used."""
return _compile(pattern, flags, kwargs).subf(format, string, count, pos,
endpos, concurrent)
def subn(pattern, repl, string, count=0, flags=0, pos=None, endpos=None,
concurrent=None, **kwargs):
"""Return a 2-tuple containing (new_string, number). new_string is the string
obtained by replacing the leftmost (or rightmost with a reverse pattern)
non-overlapping occurrences of the pattern in the source string by the
replacement repl. number is the number of substitutions that were made. repl
can be either a string or a callable; if a string, backslash escapes in it
are processed; if a callable, it's passed the match object and must return a
replacement string to be used."""
return _compile(pattern, flags, kwargs).subn(repl, string, count, pos,
endpos, concurrent)
def subfn(pattern, format, string, count=0, flags=0, pos=None, endpos=None,
concurrent=None, **kwargs):
"""Return a 2-tuple containing (new_string, number). new_string is the string
obtained by replacing the leftmost (or rightmost with a reverse pattern)
non-overlapping occurrences of the pattern in the source string by the
replacement format. number is the number of substitutions that were made. format
can be either a string or a callable; if a string, it's treated as a format
string; if a callable, it's passed the match object and must return a
replacement string to be used."""
return _compile(pattern, flags, kwargs).subfn(format, string, count, pos,
endpos, concurrent)
def split(pattern, string, maxsplit=0, flags=0, concurrent=None, **kwargs):
"""Split the source string by the occurrences of the pattern, returning a
list containing the resulting substrings. If capturing parentheses are used
in pattern, then the text of all groups in the pattern are also returned as
part of the resulting list. If maxsplit is nonzero, at most maxsplit splits
occur, and the remainder of the string is returned as the final element of
the list."""
return _compile(pattern, flags, kwargs).split(string, maxsplit, concurrent)
def splititer(pattern, string, maxsplit=0, flags=0, concurrent=None, **kwargs):
"Return an iterator yielding the parts of a split string."
return _compile(pattern, flags, kwargs).splititer(string, maxsplit,
concurrent)
def findall(pattern, string, flags=0, pos=None, endpos=None, overlapped=False,
concurrent=None, **kwargs):
"""Return a list of all matches in the string. The matches may be overlapped
if overlapped is True. If one or more groups are present in the pattern,
return a list of groups; this will be a list of tuples if the pattern has
more than one group. Empty matches are included in the result."""
return _compile(pattern, flags, kwargs).findall(string, pos, endpos,
overlapped, concurrent)
def finditer(pattern, string, flags=0, pos=None, endpos=None, overlapped=False,
partial=False, concurrent=None, **kwargs):
"""Return an iterator over all matches in the string. The matches may be
overlapped if overlapped is True. For each match, the iterator returns a
match object. Empty matches are included in the result."""
return _compile(pattern, flags, kwargs).finditer(string, pos, endpos,
overlapped, concurrent, partial)
def compile(pattern, flags=0, **kwargs):
"Compile a regular expression pattern, returning a pattern object."
return _compile(pattern, flags, kwargs)
def purge():
"Clear the regular expression cache"
_cache.clear()
_locale_sensitive.clear()
def template(pattern, flags=0):
"Compile a template pattern, returning a pattern object."
return _compile(pattern, flags | TEMPLATE)
def escape(pattern, special_only=False):
"Escape all non-alphanumeric characters or special characters in pattern."
if isinstance(pattern, str):
s = []
if special_only:
for c in pattern:
if c in _METACHARS:
s.append("\\")
s.append(c)
elif c == "\x00":
s.append("\\000")
else:
s.append(c)
else:
for c in pattern:
if c in _ALNUM:
s.append(c)
elif c == "\x00":
s.append("\\000")
else:
s.append("\\")
s.append(c)
return "".join(s)
else:
s = []
if special_only:
for c in pattern:
if chr(c) in _METACHARS:
s.extend(b"\\")
s.append(c)
elif c == 0:
s.extend(b"\\000")
else:
s.append(c)
else:
for c in pattern:
if chr(c) in _ALNUM:
s.append(c)
elif c == 0:
s.extend(b"\\000")
else:
s.extend(b"\\")
s.append(c)
return bytes(s)
# --------------------------------------------------------------------
# Internals.
import _regex_core
import _regex
from threading import RLock as _RLock
from locale import getlocale as _getlocale
from _regex_core import *
from _regex_core import (_ALL_VERSIONS, _ALL_ENCODINGS, _FirstSetError,
_UnscopedFlagSet, _check_group_features, _compile_firstset,
_compile_replacement, _flatten_code, _fold_case, _get_required_string,
_parse_pattern, _shrink_cache)
from _regex_core import (ALNUM as _ALNUM, Info as _Info, OP as _OP, Source as
_Source, Fuzzy as _Fuzzy)
# Version 0 is the old behaviour, compatible with the original 're' module.
# Version 1 is the new behaviour, which differs slightly.
DEFAULT_VERSION = VERSION0
_METACHARS = frozenset("()[]{}?*+|^$\\.")
_regex_core.DEFAULT_VERSION = DEFAULT_VERSION
# Caches for the patterns and replacements.
_cache = {}
_cache_lock = _RLock()
_named_args = {}
_replacement_cache = {}
_locale_sensitive = {}
# Maximum size of the cache.
_MAXCACHE = 500
_MAXREPCACHE = 500
def _compile(pattern, flags=0, kwargs={}):
"Compiles a regular expression to a PatternObject."
# We won't bother to cache the pattern if we're debugging.
debugging = (flags & DEBUG) != 0
# What locale is this pattern using?
locale_key = (type(pattern), pattern)
if _locale_sensitive.get(locale_key, True) or (flags & LOCALE) != 0:
# This pattern is, or might be, locale-sensitive.
pattern_locale = _getlocale()[1]
else:
# This pattern is definitely not locale-sensitive.
pattern_locale = None
if not debugging:
try:
# Do we know what keyword arguments are needed?
args_key = pattern, type(pattern), flags
args_needed = _named_args[args_key]
# Are we being provided with its required keyword arguments?
args_supplied = set()
if args_needed:
for k, v in args_needed:
try:
args_supplied.add((k, frozenset(kwargs[k])))
except KeyError:
raise error("missing named list: {!r}".format(k))
args_supplied = frozenset(args_supplied)
# Have we already seen this regular expression and named list?
pattern_key = (pattern, type(pattern), flags, args_supplied,
DEFAULT_VERSION, pattern_locale)
return _cache[pattern_key]
except KeyError:
# It's a new pattern, or new named list for a known pattern.
pass
# Guess the encoding from the class of the pattern string.
if isinstance(pattern, str):
guess_encoding = UNICODE
elif isinstance(pattern, bytes):
guess_encoding = ASCII
elif isinstance(pattern, _pattern_type):
if flags:
raise ValueError("cannot process flags argument with a compiled pattern")
return pattern
else:
raise TypeError("first argument must be a string or compiled pattern")
# Set the default version in the core code in case it has been changed.
_regex_core.DEFAULT_VERSION = DEFAULT_VERSION
caught_exception = None
global_flags = flags
while True:
try:
source = _Source(pattern)
info = _Info(global_flags, source.char_type, kwargs)
info.guess_encoding = guess_encoding
source.ignore_space = bool(info.flags & VERBOSE)
parsed = _parse_pattern(source, info)
break
except _UnscopedFlagSet:
# Remember the global flags for the next attempt.
global_flags = info.global_flags
except error as e:
caught_exception = e
if caught_exception:
raise error(caught_exception.msg, caught_exception.pattern,
caught_exception.pos)
if not source.at_end():
raise error("trailing characters in pattern", pattern, source.pos)
# Check the global flags for conflicts.
version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION
if version not in (0, VERSION0, VERSION1):
raise ValueError("VERSION0 and VERSION1 flags are mutually incompatible")
if (info.flags & _ALL_ENCODINGS) not in (0, ASCII, LOCALE, UNICODE):
raise ValueError("ASCII, LOCALE and UNICODE flags are mutually incompatible")
if isinstance(pattern, bytes) and (info.flags & UNICODE):
raise ValueError("cannot use UNICODE flag with a bytes pattern")
if not (info.flags & _ALL_ENCODINGS):
if isinstance(pattern, str):
info.flags |= UNICODE
else:
info.flags |= ASCII
reverse = bool(info.flags & REVERSE)
fuzzy = isinstance(parsed, _Fuzzy)
# Remember whether this pattern as an inline locale flag.
_locale_sensitive[locale_key] = info.inline_locale
# Should we print the parsed pattern?
if flags & DEBUG:
parsed.dump(indent=0, reverse=reverse)
# Fix the group references.
parsed.fix_groups(pattern, reverse, False)
# Optimise the parsed pattern.
parsed = parsed.optimise(info)
parsed = parsed.pack_characters(info)
# Get the required string.
req_offset, req_chars, req_flags = _get_required_string(parsed, info.flags)
# Build the named lists.
named_lists = {}
named_list_indexes = [None] * len(info.named_lists_used)
args_needed = set()
for key, index in info.named_lists_used.items():
name, case_flags = key
values = frozenset(kwargs[name])
if case_flags:
items = frozenset(_fold_case(info, v) for v in values)
else:
items = values
named_lists[name] = values
named_list_indexes[index] = items
args_needed.add((name, values))
# Check the features of the groups.
_check_group_features(info, parsed)
# Compile the parsed pattern. The result is a list of tuples.
code = parsed.compile(reverse)
# Is there a group call to the pattern as a whole?
key = (0, reverse, fuzzy)
ref = info.call_refs.get(key)
if ref is not None:
code = [(_OP.CALL_REF, ref)] + code + [(_OP.END, )]
# Add the final 'success' opcode.
code += [(_OP.SUCCESS, )]
# Compile the additional copies of the groups that we need.
for group, rev, fuz in info.additional_groups:
code += group.compile(rev, fuz)
# Flatten the code into a list of ints.
code = _flatten_code(code)
if not parsed.has_simple_start():
# Get the first set, if possible.
try:
fs_code = _compile_firstset(info, parsed.get_firstset(reverse))
fs_code = _flatten_code(fs_code)
code = fs_code + code
except _FirstSetError:
pass
# The named capture groups.
index_group = dict((v, n) for n, v in info.group_index.items())
# Create the PatternObject.
#
# Local flags like IGNORECASE affect the code generation, but aren't needed
# by the PatternObject itself. Conversely, global flags like LOCALE _don't_
# affect the code generation but _are_ needed by the PatternObject.
compiled_pattern = _regex.compile(pattern, info.flags | version, code,
info.group_index, index_group, named_lists, named_list_indexes,
req_offset, req_chars, req_flags, info.group_count)
# Do we need to reduce the size of the cache?
if len(_cache) >= _MAXCACHE:
with _cache_lock:
_shrink_cache(_cache, _named_args, _locale_sensitive, _MAXCACHE)
if not debugging:
if (info.flags & LOCALE) == 0:
pattern_locale = None
args_needed = frozenset(args_needed)
# Store this regular expression and named list.
pattern_key = (pattern, type(pattern), flags, args_needed,
DEFAULT_VERSION, pattern_locale)
_cache[pattern_key] = compiled_pattern
# Store what keyword arguments are needed.
_named_args[args_key] = args_needed
return compiled_pattern
def _compile_replacement_helper(pattern, template):
"Compiles a replacement template."
# This function is called by the _regex module.
# Have we seen this before?
key = pattern.pattern, pattern.flags, template
compiled = _replacement_cache.get(key)
if compiled is not None:
return compiled
if len(_replacement_cache) >= _MAXREPCACHE:
_replacement_cache.clear()
is_unicode = isinstance(template, str)
source = _Source(template)
if is_unicode:
def make_string(char_codes):
return "".join(chr(c) for c in char_codes)
else:
def make_string(char_codes):
return bytes(char_codes)
compiled = []
literal = []
while True:
ch = source.get()
if not ch:
break
if ch == "\\":
# '_compile_replacement' will return either an int group reference
# or a string literal. It returns items (plural) in order to handle
# a 2-character literal (an invalid escape sequence).
is_group, items = _compile_replacement(source, pattern, is_unicode)
if is_group:
# It's a group, so first flush the literal.
if literal:
compiled.append(make_string(literal))
literal = []
compiled.extend(items)
else:
literal.extend(items)
else:
literal.append(ord(ch))
# Flush the literal.
if literal:
compiled.append(make_string(literal))
_replacement_cache[key] = compiled
return compiled
# We define _pattern_type here after all the support objects have been defined.
_pattern_type = type(_compile("", 0, {}))
# We'll define an alias for the 'compile' function so that the repr of a
# pattern object is eval-able.
Regex = compile
# Register myself for pickling.
import copyreg as _copy_reg
def _pickle(p):
return _compile, (p.pattern, p.flags)
_copy_reg.pickle(_pattern_type, _pickle, _compile)
| ajibawa-2023/Python-Code-Large/train/row_1390 | 231 | 685 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L16_C0", "label": "expression", "type": "expression", "loc": [16, 217], "level": 0, "parent": null, "vector": [8, 0, 0.1701, 0.2949, 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\"\"\"Support for regular expressions (RE).\n\nThis module provides regular expression matching operations similar to those\nfound in Perl. It supports both 8-bit and Unicode strings; both the pattern and\nthe strings being processed can contain null bytes and characters outside the\nUS ASCII range.\n\nRegular expressions can contain both special and ordinary characters. Most"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L220_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [220, 226], "level": 0, "parent": null, "vector": [14, 0, 0.3255, 0.0102, 0, 0.66, 0.0244, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = [\"compile\", \"escape\", \"findall\", \"finditer\", \"fullmatch\", \"match\",\n \"purge\", \"search\", \"split\", \"splititer\", \"sub\", \"subf\", \"subfn\", \"subn\",\n \"template\", \"Scanner\", \"A\", \"ASCII\", \"B\", \"BESTMATCH\", \"D\", \"DEBUG\", \"E\",\n \"ENHANCEMATCH\", \"S\", \"DOTALL\", \"F\", \"FULLCASE\", \"I\", \"IGNORECASE\", \"L\",\n \"LOCALE\", \"M\", \"MULTILINE\", \"R\", \"REVERSE\", \"T\", \"TEMPLATE\", \"U\", \"UNICODE\",\n \"V0\", \"VERSION0\", \"V1\", \"VERSION1\", \"X\", \"VERBOSE\", \"W\", \"WORD\", \"error\",\n \"Regex\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L228_C0", "label": "__version__ =", "type": "assigned_variable", "loc": [228, 228], "level": 0, "parent": null, "vector": [14, 0, 0.3328, 0.0015, 0, 0.66, 0.0488, 162, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__version__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__version__ = \"2.4.58\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L233_C0", "label": "match", "type": "function", "loc": [233, 238], "level": 0, "parent": null, "vector": [2, 0, 0.3438, 0.0088, 0, 0.66, 0.0732, 36, 0, 8, 1, 0, 0, 0, 2], "semantic": {"name": "match", "arg_names": ["pattern", "string", "flags", "pos", "endpos", "partial", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def match(pattern, string, flags=0, pos=None, endpos=None, partial=False,\n concurrent=None, **kwargs):\n \"\"\"Try to apply the pattern at the start of the string, returning a match\n object, or None if no match was found.\"\"\"\n return _compile(pattern, flags, kwargs).match(string, pos, endpos,\n concurrent, partial)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L235_C4", "label": "expression", "type": "expression", "loc": [235, 236], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L233_C0", "vector": [8, 1, 0.3438, 0.0029, 1, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Try to apply the pattern at the start of the string, returning a match\n object, or None if no match was found.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L237_C4", "label": "return", "type": "return", "loc": [237, 238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L233_C0", "vector": [13, 1, 0.3467, 0.0029, 1, 0.39, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).match(string, pos, endpos,\n concurrent, partial)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L240_C0", "label": "fullmatch", "type": "function", "loc": [240, 245], "level": 0, "parent": null, "vector": [2, 0, 0.354, 0.0088, 0, 0.66, 0.0976, 188, 0, 8, 1, 0, 0, 0, 2], "semantic": {"name": "fullmatch", "arg_names": ["pattern", "string", "flags", "pos", "endpos", "partial", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def fullmatch(pattern, string, flags=0, pos=None, endpos=None, partial=False,\n concurrent=None, **kwargs):\n \"\"\"Try to apply the pattern against all of the string, returning a match\n object, or None if no match was found.\"\"\"\n return _compile(pattern, flags, kwargs).fullmatch(string, pos, endpos,\n concurrent, partial)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L242_C4", "label": "expression", "type": "expression", "loc": [242, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L240_C0", "vector": [8, 1, 0.354, 0.0029, 1, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Try to apply the pattern against all of the string, returning a match\n object, or None if no match was found.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L244_C4", "label": "return", "type": "return", "loc": [244, 245], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L240_C0", "vector": [13, 1, 0.3569, 0.0029, 1, 0.46, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).fullmatch(string, pos, endpos,\n concurrent, partial)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L247_C0", "label": "search", "type": "function", "loc": [247, 252], "level": 0, "parent": null, "vector": [2, 0, 0.3642, 0.0088, 0, 0.66, 0.122, 163, 0, 8, 1, 0, 0, 0, 2], "semantic": {"name": "search", "arg_names": ["pattern", "string", "flags", "pos", "endpos", "partial", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def search(pattern, string, flags=0, pos=None, endpos=None, partial=False,\n concurrent=None, **kwargs):\n \"\"\"Search through string looking for a match to the pattern, returning a\n match object, or None if no match was found.\"\"\"\n return _compile(pattern, flags, kwargs).search(string, pos, endpos,\n concurrent, partial)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L249_C4", "label": "expression", "type": "expression", "loc": [249, 250], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L247_C0", "vector": [8, 1, 0.3642, 0.0029, 1, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Search through string looking for a match to the pattern, returning a\n match object, or None if no match was found.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L251_C4", "label": "return", "type": "return", "loc": [251, 252], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L247_C0", "vector": [13, 1, 0.3672, 0.0029, 1, 0.4, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).search(string, pos, endpos,\n concurrent, partial)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L254_C0", "label": "sub", "type": "function", "loc": [254, 262], "level": 0, "parent": null, "vector": [2, 0, 0.3766, 0.0131, 0, 0.66, 0.1463, 819, 0, 9, 1, 0, 0, 0, 2], "semantic": {"name": "sub", "arg_names": ["pattern", "repl", "string", "count", "flags", "pos", "endpos", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def sub(pattern, repl, string, count=0, flags=0, pos=None, endpos=None,\n concurrent=None, **kwargs):\n \"\"\"Return the string obtained by replacing the leftmost (or rightmost with a\n reverse pattern) non-overlapping occurrences of the pattern in string by the\n replacement repl. repl can be either a string or a callable; if a string,\n backslash escapes in it are processed; if a callable, it's passed the match\n object and must return a replacement string to be used.\"\"\"\n return _compile(pattern, flags, kwargs).sub(repl, string, count, pos,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L256_C4", "label": "expression", "type": "expression", "loc": [256, 260], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L254_C0", "vector": [8, 1, 0.3766, 0.0073, 1, 0.34, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return the string obtained by replacing the leftmost (or rightmost with a\n reverse pattern) non-overlapping occurrences of the pattern in string by the\n replacement repl. repl can be either a string or a callable; if a string,\n backslash escapes in it are processed; if a callable, it's passed the match\n object and must return a replacement string to be used.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L261_C4", "label": "return", "type": "return", "loc": [261, 262], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L254_C0", "vector": [13, 1, 0.3818, 0.0029, 1, 0.34, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).sub(repl, string, count, pos,\n endpos, concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L264_C0", "label": "subf", "type": "function", "loc": [264, 272], "level": 0, "parent": null, "vector": [2, 0, 0.3912, 0.0131, 0, 0.66, 0.1707, 65, 0, 9, 1, 0, 0, 0, 2], "semantic": {"name": "subf", "arg_names": ["pattern", "format", "string", "count", "flags", "pos", "endpos", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def subf(pattern, format, string, count=0, flags=0, pos=None, endpos=None,\n concurrent=None, **kwargs):\n \"\"\"Return the string obtained by replacing the leftmost (or rightmost with a\n reverse pattern) non-overlapping occurrences of the pattern in string by the\n replacement format. format can be either a string or a callable; if a string,\n it's treated as a format string; if a callable, it's passed the match object\n and must return a replacement string to be used.\"\"\"\n return _compile(pattern, flags, kwargs).subf(format, string, count, pos,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L266_C4", "label": "expression", "type": "expression", "loc": [266, 270], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L264_C0", "vector": [8, 1, 0.3912, 0.0073, 1, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return the string obtained by replacing the leftmost (or rightmost with a\n reverse pattern) non-overlapping occurrences of the pattern in string by the\n replacement format. format can be either a string or a callable; if a string,\n it's treated as a format string; if a callable, it's passed the match object\n and must return a replacement string to be used.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L271_C4", "label": "return", "type": "return", "loc": [271, 272], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L264_C0", "vector": [13, 1, 0.3964, 0.0029, 1, 0.98, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).subf(format, string, count, pos,\n endpos, concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L274_C0", "label": "subn", "type": "function", "loc": [274, 284], "level": 0, "parent": null, "vector": [2, 0, 0.4073, 0.0161, 0, 0.66, 0.1951, 556, 0, 9, 1, 0, 0, 0, 2], "semantic": {"name": "subn", "arg_names": ["pattern", "repl", "string", "count", "flags", "pos", "endpos", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def subn(pattern, repl, string, count=0, flags=0, pos=None, endpos=None,\n concurrent=None, **kwargs):\n \"\"\"Return a 2-tuple containing (new_string, number). new_string is the string\n obtained by replacing the leftmost (or rightmost with a reverse pattern)\n non-overlapping occurrences of the pattern in the source string by the\n replacement repl. number is the number of substitutions that were made. repl\n can be either a string or a callable; if a string, backslash escapes in it\n are processed; if a callable, it's passed the match object and must return a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L276_C4", "label": "expression", "type": "expression", "loc": [276, 282], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L274_C0", "vector": [8, 1, 0.4073, 0.0102, 1, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a 2-tuple containing (new_string, number). new_string is the string\n obtained by replacing the leftmost (or rightmost with a reverse pattern)\n non-overlapping occurrences of the pattern in the source string by the\n replacement repl. number is the number of substitutions that were made. repl\n can be either a string or a callable; if a string, backslash escapes in it\n are processed; if a callable, it's passed the match object and must return a\n replacement string to be used.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L283_C4", "label": "return", "type": "return", "loc": [283, 284], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L274_C0", "vector": [13, 1, 0.4139, 0.0029, 1, 0.22, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).subn(repl, string, count, pos,\n endpos, concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L286_C0", "label": "subfn", "type": "function", "loc": [286, 296], "level": 0, "parent": null, "vector": [2, 0, 0.4248, 0.0161, 0, 0.66, 0.2195, 739, 0, 9, 1, 0, 0, 0, 2], "semantic": {"name": "subfn", "arg_names": ["pattern", "format", "string", "count", "flags", "pos", "endpos", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def subfn(pattern, format, string, count=0, flags=0, pos=None, endpos=None,\n concurrent=None, **kwargs):\n \"\"\"Return a 2-tuple containing (new_string, number). new_string is the string\n obtained by replacing the leftmost (or rightmost with a reverse pattern)\n non-overlapping occurrences of the pattern in the source string by the\n replacement format. number is the number of substitutions that were made. format\n can be either a string or a callable; if a string, it's treated as a format\n string; if a callable, it's passed the match object and must return a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L288_C4", "label": "expression", "type": "expression", "loc": [288, 294], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L286_C0", "vector": [8, 1, 0.4248, 0.0102, 1, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a 2-tuple containing (new_string, number). new_string is the string\n obtained by replacing the leftmost (or rightmost with a reverse pattern)\n non-overlapping occurrences of the pattern in the source string by the\n replacement format. number is the number of substitutions that were made. format\n can be either a string or a callable; if a string, it's treated as a format\n string; if a callable, it's passed the match object and must return a\n replacement string to be used.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L295_C4", "label": "return", "type": "return", "loc": [295, 296], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L286_C0", "vector": [13, 1, 0.4314, 0.0029, 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 _compile(pattern, flags, kwargs).subfn(format, string, count, pos,\n endpos, concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L298_C0", "label": "split", "type": "function", "loc": [298, 305], "level": 0, "parent": null, "vector": [2, 0, 0.4401, 0.0117, 0, 0.66, 0.2439, 908, 0, 6, 1, 0, 0, 0, 2], "semantic": {"name": "split", "arg_names": ["pattern", "string", "maxsplit", "flags", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def split(pattern, string, maxsplit=0, flags=0, concurrent=None, **kwargs):\n \"\"\"Split the source string by the occurrences of the pattern, returning a\n list containing the resulting substrings. If capturing parentheses are used\n in pattern, then the text of all groups in the pattern are also returned as\n part of the resulting list. If maxsplit is nonzero, at most maxsplit splits\n occur, and the remainder of the string is returned as the final element of\n the list.\"\"\"\n return _compile(pattern, flags, kwargs).split(string, maxsplit, concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L299_C4", "label": "expression", "type": "expression", "loc": [299, 304], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L298_C0", "vector": [8, 1, 0.4401, 0.0088, 1, 0.96, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Split the source string by the occurrences of the pattern, returning a\n list containing the resulting substrings. If capturing parentheses are used\n in pattern, then the text of all groups in the pattern are also returned as\n part of the resulting list. If maxsplit is nonzero, at most maxsplit splits\n occur, and the remainder of the string is returned as the final element of\n the list.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L305_C4", "label": "return", "type": "return", "loc": [305, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L298_C0", "vector": [13, 1, 0.4453, 0.0015, 1, 0.96, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).split(string, maxsplit, concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L307_C0", "label": "splititer", "type": "function", "loc": [307, 310], "level": 0, "parent": null, "vector": [2, 0, 0.4504, 0.0058, 0, 0.66, 0.2683, 145, 0, 6, 1, 0, 0, 0, 2], "semantic": {"name": "splititer", "arg_names": ["pattern", "string", "maxsplit", "flags", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def splititer(pattern, string, maxsplit=0, flags=0, concurrent=None, **kwargs):\n \"Return an iterator yielding the parts of a split string.\"\n return _compile(pattern, flags, kwargs).splititer(string, maxsplit,\n concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L308_C4", "label": "expression", "type": "expression", "loc": [308, 308], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L307_C0", "vector": [8, 1, 0.4496, 0.0015, 1, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Return an iterator yielding the parts of a split string.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L309_C4", "label": "return", "type": "return", "loc": [309, 310], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L307_C0", "vector": [13, 1, 0.4518, 0.0029, 1, 0.67, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).splititer(string, maxsplit,\n concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L312_C0", "label": "findall", "type": "function", "loc": [312, 319], "level": 0, "parent": null, "vector": [2, 0, 0.4606, 0.0117, 0, 0.66, 0.2927, 737, 0, 8, 1, 0, 0, 0, 2], "semantic": {"name": "findall", "arg_names": ["pattern", "string", "flags", "pos", "endpos", "overlapped", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def findall(pattern, string, flags=0, pos=None, endpos=None, overlapped=False,\n concurrent=None, **kwargs):\n \"\"\"Return a list of all matches in the string. The matches may be overlapped\n if overlapped is True. If one or more groups are present in the pattern,\n return a list of groups; this will be a list of tuples if the pattern has\n more than one group. Empty matches are included in the result.\"\"\"\n return _compile(pattern, flags, kwargs).findall(string, pos, endpos,\n overlapped, concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L314_C4", "label": "expression", "type": "expression", "loc": [314, 317], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L312_C0", "vector": [8, 1, 0.4606, 0.0058, 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 list of all matches in the string. The matches may be overlapped\n if overlapped is True. If one or more groups are present in the pattern,\n return a list of groups; this will be a list of tuples if the pattern has\n more than one group. Empty matches are included in the result.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L318_C4", "label": "return", "type": "return", "loc": [318, 319], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L312_C0", "vector": [13, 1, 0.465, 0.0029, 1, 0.11, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).findall(string, pos, endpos,\n overlapped, concurrent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L321_C0", "label": "finditer", "type": "function", "loc": [321, 327], "level": 0, "parent": null, "vector": [2, 0, 0.473, 0.0102, 0, 0.66, 0.3171, 131, 0, 9, 1, 0, 0, 0, 2], "semantic": {"name": "finditer", "arg_names": ["pattern", "string", "flags", "pos", "endpos", "overlapped", "partial", "concurrent", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def finditer(pattern, string, flags=0, pos=None, endpos=None, overlapped=False,\n partial=False, concurrent=None, **kwargs):\n \"\"\"Return an iterator over all matches in the string. The matches may be\n overlapped if overlapped is True. For each match, the iterator returns a\n match object. Empty matches are included in the result.\"\"\"\n return _compile(pattern, flags, kwargs).finditer(string, pos, endpos,\n overlapped, concurrent, partial)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L323_C4", "label": "expression", "type": "expression", "loc": [323, 325], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L321_C0", "vector": [8, 1, 0.473, 0.0044, 1, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return an iterator over all matches in the string. The matches may be\n overlapped if overlapped is True. For each match, the iterator returns a\n match object. Empty matches are included in the result.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L326_C4", "label": "return", "type": "return", "loc": [326, 327], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L321_C0", "vector": [13, 1, 0.4766, 0.0029, 1, 0.49, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs).finditer(string, pos, endpos,\n overlapped, concurrent, partial)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L329_C0", "label": "compile", "type": "function", "loc": [329, 331], "level": 0, "parent": null, "vector": [2, 0, 0.4818, 0.0044, 0, 0.66, 0.3415, 821, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "compile", "arg_names": ["pattern", "flags", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def compile(pattern, flags=0, **kwargs):\n \"Compile a regular expression pattern, returning a pattern object.\"\n return _compile(pattern, flags, kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L330_C4", "label": "expression", "type": "expression", "loc": [330, 330], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L329_C0", "vector": [8, 1, 0.4818, 0.0015, 1, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Compile a regular expression pattern, returning a pattern object.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L331_C4", "label": "return", "type": "return", "loc": [331, 331], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L329_C0", "vector": [13, 1, 0.4832, 0.0015, 1, 0.81, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags, kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L333_C0", "label": "purge", "type": "function", "loc": [333, 336], "level": 0, "parent": null, "vector": [2, 0, 0.4883, 0.0058, 0, 0.66, 0.3659, 919, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "purge", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def purge():\n \"Clear the regular expression cache\"\n _cache.clear()\n _locale_sensitive.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L334_C4", "label": "expression", "type": "expression", "loc": [334, 334], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L333_C0", "vector": [8, 1, 0.4876, 0.0015, 1, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Clear the regular expression cache\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L335_C4", "label": "clear()", "type": "expression", "loc": [335, 335], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L333_C0", "vector": [8, 1, 0.4891, 0.0015, 1, 0.86, 0.5, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " _cache.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L336_C4", "label": "clear()", "type": "expression", "loc": [336, 336], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L333_C0", "vector": [8, 1, 0.4905, 0.0015, 1, 0.86, 1.0, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " _locale_sensitive.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L338_C0", "label": "template", "type": "function", "loc": [338, 340], "level": 0, "parent": null, "vector": [2, 0, 0.4949, 0.0044, 0, 0.66, 0.3902, 549, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "template", "arg_names": ["pattern", "flags"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def template(pattern, flags=0):\n \"Compile a template pattern, returning a pattern object.\"\n return _compile(pattern, flags | TEMPLATE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L339_C4", "label": "expression", "type": "expression", "loc": [339, 339], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L338_C0", "vector": [8, 1, 0.4949, 0.0015, 1, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Compile a template pattern, returning a pattern object.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L340_C4", "label": "return", "type": "return", "loc": [340, 340], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L338_C0", "vector": [13, 1, 0.4964, 0.0015, 1, 0.85, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile(pattern, flags | TEMPLATE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L342_C0", "label": "escape", "type": "function", "loc": [342, 387], "level": 0, "parent": null, "vector": [2, 0, 0.5321, 0.0672, 0, 0.66, 0.4146, 494, 0, 2, 1, 0, 0, 0, 21], "semantic": {"name": "escape", "arg_names": ["pattern", "special_only"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def escape(pattern, special_only=False):\n \"Escape all non-alphanumeric characters or special characters in pattern.\"\n if isinstance(pattern, str):\n s = []\n if special_only:\n for c in pattern:\n if c in _METACHARS:\n s.append(\"\\\\\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L343_C4", "label": "expression", "type": "expression", "loc": [343, 343], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L342_C0", "vector": [8, 1, 0.5007, 0.0015, 1, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Escape all non-alphanumeric characters or special characters in pattern.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L344_C4", "label": "if", "type": "if", "loc": [344, 387], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L342_C0", "vector": [4, 1, 0.5336, 0.0642, 1, 0.84, 1.0, 0, 3, 0, 0, 0, 0, 0, 21], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(pattern, str):\n s = []\n if special_only:\n for c in pattern:\n if c in _METACHARS:\n s.append(\"\\\\\")\n s.append(c)\n elif c == \"\\x00\":"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L345_C8", "label": "s =", "type": "assigned_variable", "loc": [345, 345], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L344_C4", "vector": [14, 2, 0.5036, 0.0015, 2, 0.76, 0.0, 553, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L346_C8", "label": "if", "type": "if", "loc": [346, 363], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L344_C4", "vector": [4, 2, 0.5175, 0.0263, 2, 0.76, 0.2, 0, 2, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if special_only:\n for c in pattern:\n if c in _METACHARS:\n s.append(\"\\\\\")\n s.append(c)\n elif c == \"\\x00\":\n s.append(\"\\\\000\")\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L347_C12", "label": "for c", "type": "for", "loc": [347, 354], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L346_C8", "vector": [6, 3, 0.5117, 0.0117, 3, 0.91, 0.0, 411, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in pattern:\n if c in _METACHARS:\n s.append(\"\\\\\")\n s.append(c)\n elif c == \"\\x00\":\n s.append(\"\\\\000\")\n else:\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L348_C16", "label": "if", "type": "if", "loc": [348, 354], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L347_C12", "vector": [4, 4, 0.5124, 0.0102, 4, 0.86, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if c in _METACHARS:\n s.append(\"\\\\\")\n s.append(c)\n elif c == \"\\x00\":\n s.append(\"\\\\000\")\n else:\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L349_C20", "label": "append()", "type": "expression", "loc": [349, 349], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L348_C16", "vector": [8, 5, 0.5095, 0.0015, 5, 0.69, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " s.append(\"\\\\\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L350_C20", "label": "append()", "type": "expression", "loc": [350, 350], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L348_C16", "vector": [8, 5, 0.5109, 0.0015, 5, 0.69, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L351_C16", "label": "if", "type": "if", "loc": [351, 354], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L348_C16", "vector": [4, 5, 0.5146, 0.0058, 5, 0.69, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif c == \"\\x00\":\n s.append(\"\\\\000\")\n else:\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L352_C20", "label": "append()", "type": "expression", "loc": [352, 352], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L351_C16", "vector": [8, 6, 0.5139, 0.0015, 6, 0.39, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " s.append(\"\\\\000\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L354_C20", "label": "append()", "type": "expression", "loc": [354, 354], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L351_C16", "vector": [8, 6, 0.5168, 0.0015, 6, 0.39, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L356_C12", "label": "for c", "type": "for", "loc": [356, 363], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L346_C8", "vector": [6, 3, 0.5248, 0.0117, 3, 0.91, 1.0, 411, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in pattern:\n if c in _ALNUM:\n s.append(c)\n elif c == \"\\x00\":\n s.append(\"\\\\000\")\n else:\n s.append(\"\\\\\")\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L357_C16", "label": "if", "type": "if", "loc": [357, 363], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L356_C12", "vector": [4, 4, 0.5255, 0.0102, 4, 0.58, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if c in _ALNUM:\n s.append(c)\n elif c == \"\\x00\":\n s.append(\"\\\\000\")\n else:\n s.append(\"\\\\\")\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L358_C20", "label": "append()", "type": "expression", "loc": [358, 358], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L357_C16", "vector": [8, 5, 0.5226, 0.0015, 5, 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": " s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L359_C16", "label": "if", "type": "if", "loc": [359, 363], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L357_C16", "vector": [4, 5, 0.527, 0.0073, 5, 0.01, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif c == \"\\x00\":\n s.append(\"\\\\000\")\n else:\n s.append(\"\\\\\")\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L360_C20", "label": "append()", "type": "expression", "loc": [360, 360], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L359_C16", "vector": [8, 6, 0.5255, 0.0015, 6, 0.39, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " s.append(\"\\\\000\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L362_C20", "label": "append()", "type": "expression", "loc": [362, 362], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L359_C16", "vector": [8, 6, 0.5285, 0.0015, 6, 0.39, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " s.append(\"\\\\\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L363_C20", "label": "append()", "type": "expression", "loc": [363, 363], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L359_C16", "vector": [8, 6, 0.5299, 0.0015, 6, 0.39, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L365_C8", "label": "return", "type": "return", "loc": [365, 365], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L344_C4", "vector": [13, 2, 0.5328, 0.0015, 2, 0.76, 0.4, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"\".join(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L367_C8", "label": "s =", "type": "assigned_variable", "loc": [367, 367], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L344_C4", "vector": [14, 2, 0.5358, 0.0015, 2, 0.76, 0.6, 553, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L368_C8", "label": "if", "type": "if", "loc": [368, 385], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L344_C4", "vector": [4, 2, 0.5496, 0.0263, 2, 0.76, 0.8, 0, 2, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if special_only:\n for c in pattern:\n if chr(c) in _METACHARS:\n s.extend(b\"\\\\\")\n s.append(c)\n elif c == 0:\n s.extend(b\"\\\\000\")\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L369_C12", "label": "for c", "type": "for", "loc": [369, 376], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L368_C8", "vector": [6, 3, 0.5438, 0.0117, 3, 0.67, 0.0, 411, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in pattern:\n if chr(c) in _METACHARS:\n s.extend(b\"\\\\\")\n s.append(c)\n elif c == 0:\n s.extend(b\"\\\\000\")\n else:\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L370_C16", "label": "if", "type": "if", "loc": [370, 376], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L369_C12", "vector": [4, 4, 0.5445, 0.0102, 4, 0.99, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if chr(c) in _METACHARS:\n s.extend(b\"\\\\\")\n s.append(c)\n elif c == 0:\n s.extend(b\"\\\\000\")\n else:\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L371_C20", "label": "extend()", "type": "expression", "loc": [371, 371], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L370_C16", "vector": [8, 5, 0.5416, 0.0015, 5, 0.48, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " s.extend(b\"\\\\\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L372_C20", "label": "append()", "type": "expression", "loc": [372, 372], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L370_C16", "vector": [8, 5, 0.5431, 0.0015, 5, 0.48, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L373_C16", "label": "if", "type": "if", "loc": [373, 376], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L370_C16", "vector": [4, 5, 0.5467, 0.0058, 5, 0.48, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif c == 0:\n s.extend(b\"\\\\000\")\n else:\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L374_C20", "label": "extend()", "type": "expression", "loc": [374, 374], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L373_C16", "vector": [8, 6, 0.546, 0.0015, 6, 0.75, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " s.extend(b\"\\\\000\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L376_C20", "label": "append()", "type": "expression", "loc": [376, 376], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L373_C16", "vector": [8, 6, 0.5489, 0.0015, 6, 0.75, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L378_C12", "label": "for c", "type": "for", "loc": [378, 385], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L368_C8", "vector": [6, 3, 0.5569, 0.0117, 3, 0.67, 1.0, 411, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in pattern:\n if chr(c) in _ALNUM:\n s.append(c)\n elif c == 0:\n s.extend(b\"\\\\000\")\n else:\n s.extend(b\"\\\\\")\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L379_C16", "label": "if", "type": "if", "loc": [379, 385], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L378_C12", "vector": [4, 4, 0.5577, 0.0102, 4, 0.1, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if chr(c) in _ALNUM:\n s.append(c)\n elif c == 0:\n s.extend(b\"\\\\000\")\n else:\n s.extend(b\"\\\\\")\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L380_C20", "label": "append()", "type": "expression", "loc": [380, 380], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L379_C16", "vector": [8, 5, 0.5547, 0.0015, 5, 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": " s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L381_C16", "label": "if", "type": "if", "loc": [381, 385], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L379_C16", "vector": [4, 5, 0.5591, 0.0073, 5, 0.01, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif c == 0:\n s.extend(b\"\\\\000\")\n else:\n s.extend(b\"\\\\\")\n s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L382_C20", "label": "extend()", "type": "expression", "loc": [382, 382], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L381_C16", "vector": [8, 6, 0.5577, 0.0015, 6, 0.25, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " s.extend(b\"\\\\000\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L384_C20", "label": "extend()", "type": "expression", "loc": [384, 384], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L381_C16", "vector": [8, 6, 0.5606, 0.0015, 6, 0.25, 0.5, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " s.extend(b\"\\\\\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L385_C20", "label": "append()", "type": "expression", "loc": [385, 385], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L381_C16", "vector": [8, 6, 0.562, 0.0015, 6, 0.25, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " s.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L387_C8", "label": "return", "type": "return", "loc": [387, 387], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L344_C4", "vector": [13, 2, 0.565, 0.0015, 2, 0.76, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bytes(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Import_L392_C0", "label": "_regex_core import _regex_core", "type": "import", "loc": [392, 392], "level": 0, "parent": null, "vector": [1, 0, 0.5723, 0.0015, 0, 0.66, 0.439, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "_regex_core", "arg_names": [], "import_names": ["_regex_core"], "rhs_call_name": "", "annotation": ""}, "snippet": "import _regex_core"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Import_L393_C0", "label": "_regex import _regex", "type": "import", "loc": [393, 393], "level": 0, "parent": null, "vector": [1, 0, 0.5737, 0.0015, 0, 0.66, 0.4634, 136, 0, 1, 0, 0, 136, 0, 0], "semantic": {"name": "_regex", "arg_names": [], "import_names": ["_regex"], "rhs_call_name": "", "annotation": ""}, "snippet": "import _regex"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:ImportFrom_L394_C0", "label": "from threading import _RLock", "type": "import", "loc": [394, 394], "level": 0, "parent": null, "vector": [1, 0, 0.5752, 0.0015, 0, 0.66, 0.4878, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["_RLock"], "rhs_call_name": "", "annotation": ""}, "snippet": "from threading import RLock as _RLock"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:ImportFrom_L395_C0", "label": "from locale import _getlocale", "type": "import", "loc": [395, 395], "level": 0, "parent": null, "vector": [1, 0, 0.5766, 0.0015, 0, 0.66, 0.5122, 884, 0, 1, 0, 0, 884, 0, 0], "semantic": {"name": "locale", "arg_names": [], "import_names": ["_getlocale"], "rhs_call_name": "", "annotation": ""}, "snippet": "from locale import getlocale as _getlocale"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:ImportFrom_L396_C0", "label": "from _regex_core import *", "type": "import", "loc": [396, 396], "level": 0, "parent": null, "vector": [1, 0, 0.5781, 0.0015, 0, 0.66, 0.5366, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "_regex_core", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from _regex_core import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:ImportFrom_L397_C0", "label": "from _regex_core import _ALL_VERSIONS, _ALL_ENCODINGS, _FirstSetError\u2026", "type": "import", "loc": [397, 400], "level": 0, "parent": null, "vector": [1, 0, 0.5818, 0.0058, 0, 0.66, 0.561, 944, 0, 12, 0, 0, 944, 0, 0], "semantic": {"name": "_regex_core", "arg_names": [], "import_names": ["_ALL_VERSIONS", "_ALL_ENCODINGS", "_FirstSetError", "_UnscopedFlagSet", "_check_group_features", "_compile_firstset", "_compile_replacement", "_flatten_code", "_fold_case", "_get_required_string", "_parse_pattern", "_shrink_cache"], "rhs_call_name": "", "annotation": ""}, "snippet": "from _regex_core import (_ALL_VERSIONS, _ALL_ENCODINGS, _FirstSetError,\n _UnscopedFlagSet, _check_group_features, _compile_firstset,\n _compile_replacement, _flatten_code, _fold_case, _get_required_string,\n _parse_pattern, _shrink_cache)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:ImportFrom_L401_C0", "label": "from _regex_core import _ALNUM, _Info, _OP\u2026", "type": "import", "loc": [401, 402], "level": 0, "parent": null, "vector": [1, 0, 0.5861, 0.0029, 0, 0.66, 0.5854, 944, 0, 5, 0, 0, 944, 0, 0], "semantic": {"name": "_regex_core", "arg_names": [], "import_names": ["_ALNUM", "_Info", "_OP", "_Source", "_Fuzzy"], "rhs_call_name": "", "annotation": ""}, "snippet": "from _regex_core import (ALNUM as _ALNUM, Info as _Info, OP as _OP, Source as\n _Source, Fuzzy as _Fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L407_C0", "label": "DEFAULT_VERSION =", "type": "assigned_variable", "loc": [407, 407], "level": 0, "parent": null, "vector": [14, 0, 0.5942, 0.0015, 0, 0.66, 0.6098, 455, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "DEFAULT_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEFAULT_VERSION = VERSION0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L409_C0", "label": "_METACHARS = frozenset()", "type": "assigned_variable", "loc": [409, 409], "level": 0, "parent": null, "vector": [14, 0, 0.5971, 0.0015, 0, 0.66, 0.6341, 45, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "_METACHARS", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": "_METACHARS = frozenset(\"()[]{}?*+|^$\\\\.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L411_C0", "label": "_regex_core.DEFAULT_VERSION =", "type": "assigned_variable", "loc": [411, 411], "level": 0, "parent": null, "vector": [14, 0, 0.6, 0.0015, 0, 0.66, 0.6585, 276, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_regex_core.DEFAULT_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_regex_core.DEFAULT_VERSION = DEFAULT_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L414_C0", "label": "_cache =", "type": "assigned_variable", "loc": [414, 414], "level": 0, "parent": null, "vector": [14, 0, 0.6044, 0.0015, 0, 0.66, 0.6829, 123, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_cache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_cache = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L415_C0", "label": "_cache_lock = _RLock()", "type": "assigned_variable", "loc": [415, 415], "level": 0, "parent": null, "vector": [14, 0, 0.6058, 0.0015, 0, 0.66, 0.7073, 397, 3, 0, 0, 0, 74, 10, 1], "semantic": {"name": "_cache_lock", "arg_names": [], "import_names": [], "rhs_call_name": "_RLock", "annotation": ""}, "snippet": "_cache_lock = _RLock()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L416_C0", "label": "_named_args =", "type": "assigned_variable", "loc": [416, 416], "level": 0, "parent": null, "vector": [14, 0, 0.6073, 0.0015, 0, 0.66, 0.7317, 36, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_named_args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_named_args = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L417_C0", "label": "_replacement_cache =", "type": "assigned_variable", "loc": [417, 417], "level": 0, "parent": null, "vector": [14, 0, 0.6088, 0.0015, 0, 0.66, 0.7561, 47, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_replacement_cache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_replacement_cache = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L418_C0", "label": "_locale_sensitive =", "type": "assigned_variable", "loc": [418, 418], "level": 0, "parent": null, "vector": [14, 0, 0.6102, 0.0015, 0, 0.66, 0.7805, 770, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_locale_sensitive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_locale_sensitive = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L421_C0", "label": "_MAXCACHE =", "type": "assigned_variable", "loc": [421, 421], "level": 0, "parent": null, "vector": [14, 0, 0.6146, 0.0015, 0, 0.66, 0.8049, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "_MAXCACHE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_MAXCACHE = 500"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L422_C0", "label": "_MAXREPCACHE =", "type": "assigned_variable", "loc": [422, 422], "level": 0, "parent": null, "vector": [14, 0, 0.6161, 0.0015, 0, 0.66, 0.8293, 254, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "_MAXREPCACHE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_MAXREPCACHE = 500"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "label": "_compile", "type": "function", "loc": [424, 618], "level": 0, "parent": null, "vector": [2, 0, 0.7606, 0.2847, 0, 0.66, 0.8537, 779, 0, 3, 1, 0, 0, 0, 58], "semantic": {"name": "_compile", "arg_names": ["pattern", "flags", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _compile(pattern, flags=0, kwargs={}):\n \"Compiles a regular expression to a PatternObject.\"\n\n # We won't bother to cache the pattern if we're debugging.\n debugging = (flags & DEBUG) != 0\n\n # What locale is this pattern using?\n locale_key = (type(pattern), pattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L425_C4", "label": "expression", "type": "expression", "loc": [425, 425], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [8, 1, 0.6204, 0.0015, 1, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Compiles a regular expression to a PatternObject.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L428_C4", "label": "debugging =", "type": "assigned_variable", "loc": [428, 428], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.6248, 0.0015, 1, 0.05, 0.025, 716, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "debugging", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " debugging = (flags & DEBUG) != 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L431_C4", "label": "locale_key =", "type": "assigned_variable", "loc": [431, 431], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.6292, 0.0015, 1, 0.05, 0.05, 400, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "locale_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " locale_key = (type(pattern), pattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L432_C4", "label": "if", "type": "if", "loc": [432, 437], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [4, 1, 0.6343, 0.0088, 1, 0.05, 0.075, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _locale_sensitive.get(locale_key, True) or (flags & LOCALE) != 0:\n # This pattern is, or might be, locale-sensitive.\n pattern_locale = _getlocale()[1]\n else:\n # This pattern is definitely not locale-sensitive.\n pattern_locale = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L434_C8", "label": "pattern_locale =", "type": "assigned_variable", "loc": [434, 434], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L432_C4", "vector": [14, 2, 0.6336, 0.0015, 2, 0.57, 0.0, 15, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pattern_locale", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pattern_locale = _getlocale()[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L437_C8", "label": "pattern_locale =", "type": "assigned_variable", "loc": [437, 437], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L432_C4", "vector": [14, 2, 0.638, 0.0015, 2, 0.57, 1.0, 15, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "pattern_locale", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pattern_locale = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L439_C4", "label": "if", "type": "if", "loc": [439, 462], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [4, 1, 0.6577, 0.035, 1, 0.05, 0.1, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not debugging:\n try:\n # Do we know what keyword arguments are needed?\n args_key = pattern, type(pattern), flags\n args_needed = _named_args[args_key]\n\n # Are we being provided with its required keyword arguments?\n args_supplied = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L440_C8", "label": "try", "type": "try", "loc": [440, 462], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L439_C4", "vector": [7, 2, 0.6584, 0.0336, 2, 0.74, 0.0, 0, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # Do we know what keyword arguments are needed?\n args_key = pattern, type(pattern), flags\n args_needed = _named_args[args_key]\n\n # Are we being provided with its required keyword arguments?\n args_supplied = set()\n if args_needed:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L442_C12", "label": "args_key =", "type": "assigned_variable", "loc": [442, 442], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L440_C8", "vector": [14, 3, 0.6453, 0.0015, 3, 0.8, 0.0, 273, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "args_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args_key = pattern, type(pattern), flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L443_C12", "label": "args_needed =", "type": "assigned_variable", "loc": [443, 443], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L440_C8", "vector": [14, 3, 0.6467, 0.0015, 3, 0.8, 0.1667, 715, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "args_needed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args_needed = _named_args[args_key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L446_C12", "label": "args_supplied = set()", "type": "assigned_variable", "loc": [446, 446], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L440_C8", "vector": [14, 3, 0.6511, 0.0015, 3, 0.8, 0.3333, 327, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "args_supplied", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " args_supplied = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L447_C12", "label": "if", "type": "if", "loc": [447, 452], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L440_C8", "vector": [4, 3, 0.6562, 0.0088, 3, 0.8, 0.5, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args_needed:\n for k, v in args_needed:\n try:\n args_supplied.add((k, frozenset(kwargs[k])))\n except KeyError:\n raise error(\"missing named list: {!r}\".format(k))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L448_C16", "label": "for k, v", "type": "for", "loc": [448, 452], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L447_C12", "vector": [6, 4, 0.6569, 0.0073, 4, 0.32, 0.0, 867, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in args_needed:\n try:\n args_supplied.add((k, frozenset(kwargs[k])))\n except KeyError:\n raise error(\"missing named list: {!r}\".format(k))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L449_C20", "label": "try", "type": "try", "loc": [449, 452], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L448_C16", "vector": [7, 5, 0.6577, 0.0058, 5, 0.25, 0.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n args_supplied.add((k, frozenset(kwargs[k])))\n except KeyError:\n raise error(\"missing named list: {!r}\".format(k))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L450_C24", "label": "add()", "type": "expression", "loc": [450, 450], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L449_C20", "vector": [8, 6, 0.6569, 0.0015, 6, 0.75, 0.0, 241, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " args_supplied.add((k, frozenset(kwargs[k])))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L454_C12", "label": "args_supplied = frozenset()", "type": "assigned_variable", "loc": [454, 454], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L440_C8", "vector": [14, 3, 0.6628, 0.0015, 3, 0.8, 0.6667, 327, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "args_supplied", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": " args_supplied = frozenset(args_supplied)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L457_C12", "label": "pattern_key =", "type": "assigned_variable", "loc": [457, 458], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L440_C8", "vector": [14, 3, 0.6679, 0.0029, 3, 0.8, 0.8333, 383, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "pattern_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pattern_key = (pattern, type(pattern), flags, args_supplied,\n DEFAULT_VERSION, pattern_locale)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L459_C12", "label": "return", "type": "return", "loc": [459, 459], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L440_C8", "vector": [13, 3, 0.6701, 0.0015, 3, 0.8, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _cache[pattern_key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L465_C4", "label": "if", "type": "if", "loc": [465, 475], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [4, 1, 0.6861, 0.0161, 1, 0.05, 0.125, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(pattern, str):\n guess_encoding = UNICODE\n elif isinstance(pattern, bytes):\n guess_encoding = ASCII\n elif isinstance(pattern, _pattern_type):\n if flags:\n raise ValueError(\"cannot process flags argument with a compiled pattern\")\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L466_C8", "label": "guess_encoding =", "type": "assigned_variable", "loc": [466, 466], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L465_C4", "vector": [14, 2, 0.6803, 0.0015, 2, 0.09, 0.0, 979, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "guess_encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " guess_encoding = UNICODE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L467_C4", "label": "if", "type": "if", "loc": [467, 475], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L465_C4", "vector": [4, 2, 0.6876, 0.0131, 2, 0.09, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(pattern, bytes):\n guess_encoding = ASCII\n elif isinstance(pattern, _pattern_type):\n if flags:\n raise ValueError(\"cannot process flags argument with a compiled pattern\")\n\n return pattern\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L468_C8", "label": "guess_encoding =", "type": "assigned_variable", "loc": [468, 468], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L467_C4", "vector": [14, 3, 0.6832, 0.0015, 3, 0.23, 0.0, 979, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "guess_encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " guess_encoding = ASCII"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L469_C4", "label": "if", "type": "if", "loc": [469, 475], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L467_C4", "vector": [4, 3, 0.6891, 0.0102, 3, 0.23, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(pattern, _pattern_type):\n if flags:\n raise ValueError(\"cannot process flags argument with a compiled pattern\")\n\n return pattern\n else:\n raise TypeError(\"first argument must be a string or compiled pattern\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L470_C8", "label": "if", "type": "if", "loc": [470, 471], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L469_C4", "vector": [4, 4, 0.6869, 0.0029, 4, 0.23, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if flags:\n raise ValueError(\"cannot process flags argument with a compiled pattern\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L473_C8", "label": "return", "type": "return", "loc": [473, 473], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L469_C4", "vector": [13, 4, 0.6905, 0.0015, 4, 0.23, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return pattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L478_C4", "label": "_regex_core.DEFAULT_VERSION =", "type": "assigned_variable", "loc": [478, 478], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.6978, 0.0015, 1, 0.05, 0.15, 276, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_regex_core.DEFAULT_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _regex_core.DEFAULT_VERSION = DEFAULT_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L480_C4", "label": "caught_exception =", "type": "assigned_variable", "loc": [480, 480], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.7007, 0.0015, 1, 0.05, 0.175, 573, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "caught_exception", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " caught_exception = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L481_C4", "label": "global_flags =", "type": "assigned_variable", "loc": [481, 481], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.7022, 0.0015, 1, 0.05, 0.2, 679, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "global_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " global_flags = flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:While_L483_C4", "label": "while", "type": "while", "loc": [483, 499], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [5, 1, 0.7168, 0.0248, 1, 0.05, 0.225, 0, 1, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n try:\n source = _Source(pattern)\n info = _Info(global_flags, source.char_type, kwargs)\n info.guess_encoding = guess_encoding\n source.ignore_space = bool(info.flags & VERBOSE)\n parsed = _parse_pattern(source, info)\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L484_C8", "label": "try", "type": "try", "loc": [484, 495], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:While_L483_C4", "vector": [7, 2, 0.7146, 0.0175, 2, 0.67, 0.0, 0, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n source = _Source(pattern)\n info = _Info(global_flags, source.char_type, kwargs)\n info.guess_encoding = guess_encoding\n source.ignore_space = bool(info.flags & VERBOSE)\n parsed = _parse_pattern(source, info)\n break\n except _UnscopedFlagSet:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L485_C12", "label": "source = _Source()", "type": "assigned_variable", "loc": [485, 485], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L484_C8", "vector": [14, 3, 0.708, 0.0015, 3, 0.24, 0.0, 703, 3, 1, 0, 0, 566, 10, 1], "semantic": {"name": "source", "arg_names": [], "import_names": [], "rhs_call_name": "_Source", "annotation": ""}, "snippet": " source = _Source(pattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L486_C12", "label": "info = _Info()", "type": "assigned_variable", "loc": [486, 486], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L484_C8", "vector": [14, 3, 0.7095, 0.0015, 3, 0.24, 0.25, 730, 3, 3, 0, 0, 287, 10, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "_Info", "annotation": ""}, "snippet": " info = _Info(global_flags, source.char_type, kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L487_C12", "label": "info.guess_encoding =", "type": "assigned_variable", "loc": [487, 487], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L484_C8", "vector": [14, 3, 0.7109, 0.0015, 3, 0.24, 0.5, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "info.guess_encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " info.guess_encoding = guess_encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L488_C12", "label": "source.ignore_space = bool()", "type": "assigned_variable", "loc": [488, 488], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L484_C8", "vector": [14, 3, 0.7124, 0.0015, 3, 0.24, 0.75, 890, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "source.ignore_space", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " source.ignore_space = bool(info.flags & VERBOSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L489_C12", "label": "parsed = _parse_pattern()", "type": "assigned_variable", "loc": [489, 489], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L484_C8", "vector": [14, 3, 0.7139, 0.0015, 3, 0.24, 1.0, 313, 3, 2, 0, 0, 68, 10, 1], "semantic": {"name": "parsed", "arg_names": [], "import_names": [], "rhs_call_name": "_parse_pattern", "annotation": ""}, "snippet": " parsed = _parse_pattern(source, info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L493_C12", "label": "global_flags =", "type": "assigned_variable", "loc": [493, 493], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L484_C8", "vector": [14, 3, 0.7197, 0.0015, 3, 0.24, 0.0, 679, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "global_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " global_flags = info.global_flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L495_C12", "label": "caught_exception =", "type": "assigned_variable", "loc": [495, 495], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L484_C8", "vector": [14, 3, 0.7226, 0.0015, 3, 0.24, 0.0, 573, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "caught_exception", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " caught_exception = e"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L497_C8", "label": "if", "type": "if", "loc": [497, 499], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:While_L483_C4", "vector": [4, 2, 0.727, 0.0044, 2, 0.67, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if caught_exception:\n raise error(caught_exception.msg, caught_exception.pattern,\n caught_exception.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L501_C4", "label": "if", "type": "if", "loc": [501, 502], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [4, 1, 0.7321, 0.0029, 1, 0.05, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not source.at_end():\n raise error(\"trailing characters in pattern\", pattern, source.pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L505_C4", "label": "version =", "type": "assigned_variable", "loc": [505, 505], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.7372, 0.0015, 1, 0.05, 0.275, 623, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L506_C4", "label": "if", "type": "if", "loc": [506, 507], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [4, 1, 0.7394, 0.0029, 1, 0.05, 0.3, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version not in (0, VERSION0, VERSION1):\n raise ValueError(\"VERSION0 and VERSION1 flags are mutually incompatible\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L509_C4", "label": "if", "type": "if", "loc": [509, 510], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [4, 1, 0.7438, 0.0029, 1, 0.05, 0.325, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (info.flags & _ALL_ENCODINGS) not in (0, ASCII, LOCALE, UNICODE):\n raise ValueError(\"ASCII, LOCALE and UNICODE flags are mutually incompatible\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L512_C4", "label": "if", "type": "if", "loc": [512, 513], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [4, 1, 0.7482, 0.0029, 1, 0.05, 0.35, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(pattern, bytes) and (info.flags & UNICODE):\n raise ValueError(\"cannot use UNICODE flag with a bytes pattern\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L515_C4", "label": "if", "type": "if", "loc": [515, 519], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [4, 1, 0.7547, 0.0073, 1, 0.05, 0.375, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not (info.flags & _ALL_ENCODINGS):\n if isinstance(pattern, str):\n info.flags |= UNICODE\n else:\n info.flags |= ASCII"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L516_C8", "label": "if", "type": "if", "loc": [516, 519], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L515_C4", "vector": [4, 2, 0.7555, 0.0058, 2, 0.77, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(pattern, str):\n info.flags |= UNICODE\n else:\n info.flags |= ASCII"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L521_C4", "label": "reverse = bool()", "type": "assigned_variable", "loc": [521, 521], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.7606, 0.0015, 1, 0.05, 0.4, 109, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "reverse", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " reverse = bool(info.flags & REVERSE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L522_C4", "label": "fuzzy = isinstance()", "type": "assigned_variable", "loc": [522, 522], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.762, 0.0015, 1, 0.05, 0.425, 20, 3, 2, 0, 0, 552, 10, 1], "semantic": {"name": "fuzzy", "arg_names": [], "import_names": [], "rhs_call_name": "isinstance", "annotation": ""}, "snippet": " fuzzy = isinstance(parsed, _Fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L525_C4", "label": "assign", "type": "assigned_variable", "loc": [525, 525], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.7664, 0.0015, 1, 0.05, 0.45, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _locale_sensitive[locale_key] = info.inline_locale"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L528_C4", "label": "if", "type": "if", "loc": [528, 529], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [4, 1, 0.7715, 0.0029, 1, 0.05, 0.475, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if flags & DEBUG:\n parsed.dump(indent=0, reverse=reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L529_C8", "label": "dump()", "type": "expression", "loc": [529, 529], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L528_C4", "vector": [8, 2, 0.7723, 0.0015, 2, 0.13, 0.0, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " parsed.dump(indent=0, reverse=reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L532_C4", "label": "fix_groups()", "type": "expression", "loc": [532, 532], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [8, 1, 0.7766, 0.0015, 1, 0.05, 0.5, 269, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "fix_groups", "arg_names": [], "import_names": [], "rhs_call_name": "fix_groups", "annotation": ""}, "snippet": " parsed.fix_groups(pattern, reverse, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L535_C4", "label": "parsed = optimise()", "type": "assigned_variable", "loc": [535, 535], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.781, 0.0015, 1, 0.05, 0.525, 313, 3, 1, 0, 0, 265, 10, 1], "semantic": {"name": "parsed", "arg_names": [], "import_names": [], "rhs_call_name": "optimise", "annotation": ""}, "snippet": " parsed = parsed.optimise(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L536_C4", "label": "parsed = pack_characters()", "type": "assigned_variable", "loc": [536, 536], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.7825, 0.0015, 1, 0.05, 0.55, 313, 3, 1, 0, 0, 434, 10, 1], "semantic": {"name": "parsed", "arg_names": [], "import_names": [], "rhs_call_name": "pack_characters", "annotation": ""}, "snippet": " parsed = parsed.pack_characters(info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L539_C4", "label": "req_offset, req_chars, req_flags = _get_required_string()", "type": "assigned_variable", "loc": [539, 539], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.7869, 0.0015, 1, 0.05, 0.575, 98, 3, 2, 0, 0, 809, 10, 1], "semantic": {"name": "req_offset, req_chars, req_flags", "arg_names": [], "import_names": [], "rhs_call_name": "_get_required_string", "annotation": ""}, "snippet": " req_offset, req_chars, req_flags = _get_required_string(parsed, info.flags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L542_C4", "label": "named_lists =", "type": "assigned_variable", "loc": [542, 542], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.7912, 0.0015, 1, 0.05, 0.6, 423, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "named_lists", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " named_lists = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L543_C4", "label": "named_list_indexes =", "type": "assigned_variable", "loc": [543, 543], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.7927, 0.0015, 1, 0.05, 0.625, 824, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "named_list_indexes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " named_list_indexes = [None] * len(info.named_lists_used)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L544_C4", "label": "args_needed = set()", "type": "assigned_variable", "loc": [544, 544], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.7942, 0.0015, 1, 0.05, 0.65, 715, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "args_needed", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " args_needed = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L545_C4", "label": "for key, index", "type": "for", "loc": [545, 554], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [6, 1, 0.8022, 0.0146, 1, 0.05, 0.675, 763, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "key, index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, index in info.named_lists_used.items():\n name, case_flags = key\n values = frozenset(kwargs[name])\n if case_flags:\n items = frozenset(_fold_case(info, v) for v in values)\n else:\n items = values\n named_lists[name] = values"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L546_C8", "label": "name, case_flags =", "type": "assigned_variable", "loc": [546, 546], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L545_C4", "vector": [14, 2, 0.7971, 0.0015, 2, 0.74, 0.0, 34, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name, case_flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name, case_flags = key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L547_C8", "label": "values = frozenset()", "type": "assigned_variable", "loc": [547, 547], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L545_C4", "vector": [14, 2, 0.7985, 0.0015, 2, 0.74, 0.2, 721, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "values", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": " values = frozenset(kwargs[name])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L548_C8", "label": "if", "type": "if", "loc": [548, 551], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L545_C4", "vector": [4, 2, 0.8022, 0.0058, 2, 0.74, 0.4, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if case_flags:\n items = frozenset(_fold_case(info, v) for v in values)\n else:\n items = values"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L549_C12", "label": "items = frozenset()", "type": "assigned_variable", "loc": [549, 549], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L548_C8", "vector": [14, 3, 0.8015, 0.0015, 3, 0.61, 0.0, 339, 3, 1, 0, 0, 80, 10, 2], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": " items = frozenset(_fold_case(info, v) for v in values)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L551_C12", "label": "items =", "type": "assigned_variable", "loc": [551, 551], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L548_C8", "vector": [14, 3, 0.8044, 0.0015, 3, 0.61, 1.0, 339, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = values"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L552_C8", "label": "assign", "type": "assigned_variable", "loc": [552, 552], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L545_C4", "vector": [14, 2, 0.8058, 0.0015, 2, 0.74, 0.6, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " named_lists[name] = values"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L553_C8", "label": "assign", "type": "assigned_variable", "loc": [553, 553], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L545_C4", "vector": [14, 2, 0.8073, 0.0015, 2, 0.74, 0.8, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " named_list_indexes[index] = items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L554_C8", "label": "add()", "type": "expression", "loc": [554, 554], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L545_C4", "vector": [8, 2, 0.8088, 0.0015, 2, 0.74, 1.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " args_needed.add((name, values))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L557_C4", "label": "_check_group_features()", "type": "expression", "loc": [557, 557], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [8, 1, 0.8131, 0.0015, 1, 0.05, 0.7, 534, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_check_group_features", "arg_names": [], "import_names": [], "rhs_call_name": "_check_group_features", "annotation": ""}, "snippet": " _check_group_features(info, parsed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L560_C4", "label": "code = compile()", "type": "assigned_variable", "loc": [560, 560], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.8175, 0.0015, 1, 0.05, 0.725, 44, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " code = parsed.compile(reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L563_C4", "label": "key =", "type": "assigned_variable", "loc": [563, 563], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.8219, 0.0015, 1, 0.05, 0.75, 230, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = (0, reverse, fuzzy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L564_C4", "label": "ref = get()", "type": "assigned_variable", "loc": [564, 564], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.8234, 0.0015, 1, 0.05, 0.775, 686, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "ref", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ref = info.call_refs.get(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L565_C4", "label": "if", "type": "if", "loc": [565, 566], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [4, 1, 0.8255, 0.0029, 1, 0.05, 0.8, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ref is not None:\n code = [(_OP.CALL_REF, ref)] + code + [(_OP.END, )]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L566_C8", "label": "code =", "type": "assigned_variable", "loc": [566, 566], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L565_C4", "vector": [14, 2, 0.8263, 0.0015, 2, 0.05, 0.0, 44, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " code = [(_OP.CALL_REF, ref)] + code + [(_OP.END, )]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L572_C4", "label": "for group, rev, fuz", "type": "for", "loc": [572, 573], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [6, 1, 0.8358, 0.0029, 1, 0.05, 0.825, 648, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "group, rev, fuz", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for group, rev, fuz in info.additional_groups:\n code += group.compile(rev, fuz)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L576_C4", "label": "code = _flatten_code()", "type": "assigned_variable", "loc": [576, 576], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.8409, 0.0015, 1, 0.05, 0.85, 44, 3, 1, 0, 0, 863, 10, 1], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "_flatten_code", "annotation": ""}, "snippet": " code = _flatten_code(code)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L578_C4", "label": "if", "type": "if", "loc": [578, 585], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [4, 1, 0.8489, 0.0117, 1, 0.05, 0.875, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not parsed.has_simple_start():\n # Get the first set, if possible.\n try:\n fs_code = _compile_firstset(info, parsed.get_firstset(reverse))\n fs_code = _flatten_code(fs_code)\n code = fs_code + code\n except _FirstSetError:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L580_C8", "label": "try", "type": "try", "loc": [580, 585], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L578_C4", "vector": [7, 2, 0.8504, 0.0088, 2, 0.26, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n fs_code = _compile_firstset(info, parsed.get_firstset(reverse))\n fs_code = _flatten_code(fs_code)\n code = fs_code + code\n except _FirstSetError:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L581_C12", "label": "fs_code = _compile_firstset()", "type": "assigned_variable", "loc": [581, 581], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L580_C8", "vector": [14, 3, 0.8482, 0.0015, 3, 0.98, 0.0, 487, 3, 2, 0, 0, 346, 10, 2], "semantic": {"name": "fs_code", "arg_names": [], "import_names": [], "rhs_call_name": "_compile_firstset", "annotation": ""}, "snippet": " fs_code = _compile_firstset(info, parsed.get_firstset(reverse))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L582_C12", "label": "fs_code = _flatten_code()", "type": "assigned_variable", "loc": [582, 582], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L580_C8", "vector": [14, 3, 0.8496, 0.0015, 3, 0.98, 0.5, 487, 3, 1, 0, 0, 863, 10, 1], "semantic": {"name": "fs_code", "arg_names": [], "import_names": [], "rhs_call_name": "_flatten_code", "annotation": ""}, "snippet": " fs_code = _flatten_code(fs_code)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L583_C12", "label": "code =", "type": "assigned_variable", "loc": [583, 583], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L580_C8", "vector": [14, 3, 0.8511, 0.0015, 3, 0.98, 1.0, 44, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " code = fs_code + code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L588_C4", "label": "index_group = dict()", "type": "assigned_variable", "loc": [588, 588], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.8584, 0.0015, 1, 0.05, 0.9, 833, 3, 1, 0, 0, 827, 10, 2], "semantic": {"name": "index_group", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " index_group = dict((v, n) for n, v in info.group_index.items())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L595_C4", "label": "compiled_pattern = compile()", "type": "assigned_variable", "loc": [595, 597], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [14, 1, 0.8701, 0.0044, 1, 0.05, 0.925, 90, 3, 11, 0, 0, 821, 10, 1], "semantic": {"name": "compiled_pattern", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " compiled_pattern = _regex.compile(pattern, info.flags | version, code,\n info.group_index, index_group, named_lists, named_list_indexes,\n req_offset, req_chars, req_flags, info.group_count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L600_C4", "label": "if", "type": "if", "loc": [600, 602], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [4, 1, 0.8774, 0.0044, 1, 0.05, 0.95, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(_cache) >= _MAXCACHE:\n with _cache_lock:\n _shrink_cache(_cache, _named_args, _locale_sensitive, _MAXCACHE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L602_C12", "label": "_shrink_cache()", "type": "expression", "loc": [602, 602], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L600_C4", "vector": [8, 2, 0.8788, 0.0015, 2, 0.8, 0.0, 717, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "_shrink_cache", "arg_names": [], "import_names": [], "rhs_call_name": "_shrink_cache", "annotation": ""}, "snippet": " _shrink_cache(_cache, _named_args, _locale_sensitive, _MAXCACHE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L604_C4", "label": "if", "type": "if", "loc": [604, 616], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [4, 1, 0.8905, 0.019, 1, 0.05, 0.975, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not debugging:\n if (info.flags & LOCALE) == 0:\n pattern_locale = None\n\n args_needed = frozenset(args_needed)\n\n # Store this regular expression and named list.\n pattern_key = (pattern, type(pattern), flags, args_needed,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L605_C8", "label": "if", "type": "if", "loc": [605, 606], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L604_C4", "vector": [4, 2, 0.8839, 0.0029, 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 (info.flags & LOCALE) == 0:\n pattern_locale = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L606_C12", "label": "pattern_locale =", "type": "assigned_variable", "loc": [606, 606], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L605_C8", "vector": [14, 3, 0.8847, 0.0015, 3, 0.02, 0.0, 15, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "pattern_locale", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pattern_locale = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L608_C8", "label": "args_needed = frozenset()", "type": "assigned_variable", "loc": [608, 608], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L604_C4", "vector": [14, 2, 0.8876, 0.0015, 2, 0.85, 0.25, 715, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "args_needed", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": " args_needed = frozenset(args_needed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L611_C8", "label": "pattern_key =", "type": "assigned_variable", "loc": [611, 612], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L604_C4", "vector": [14, 2, 0.8927, 0.0029, 2, 0.85, 0.5, 383, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "pattern_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pattern_key = (pattern, type(pattern), flags, args_needed,\n DEFAULT_VERSION, pattern_locale)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L613_C8", "label": "assign", "type": "assigned_variable", "loc": [613, 613], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L604_C4", "vector": [14, 2, 0.8949, 0.0015, 2, 0.85, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _cache[pattern_key] = compiled_pattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L616_C8", "label": "assign", "type": "assigned_variable", "loc": [616, 616], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L604_C4", "vector": [14, 2, 0.8993, 0.0015, 2, 0.85, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _named_args[args_key] = args_needed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L618_C4", "label": "return", "type": "return", "loc": [618, 618], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "vector": [13, 1, 0.9022, 0.0015, 1, 0.05, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return compiled_pattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "label": "_compile_replacement_helper", "type": "function", "loc": [620, 670], "level": 0, "parent": null, "vector": [2, 0, 0.9416, 0.0745, 0, 0.66, 0.878, 546, 0, 2, 1, 0, 0, 0, 18], "semantic": {"name": "_compile_replacement_helper", "arg_names": ["pattern", "template"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _compile_replacement_helper(pattern, template):\n \"Compiles a replacement template.\"\n # This function is called by the _regex module.\n\n # Have we seen this before?\n key = pattern.pattern, pattern.flags, template\n compiled = _replacement_cache.get(key)\n if compiled is not None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L621_C4", "label": "expression", "type": "expression", "loc": [621, 621], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "vector": [8, 1, 0.9066, 0.0015, 1, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Compiles a replacement template.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L625_C4", "label": "key =", "type": "assigned_variable", "loc": [625, 625], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "vector": [14, 1, 0.9124, 0.0015, 1, 0.13, 0.0769, 230, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = pattern.pattern, pattern.flags, template"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L626_C4", "label": "compiled = get()", "type": "assigned_variable", "loc": [626, 626], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "vector": [14, 1, 0.9139, 0.0015, 1, 0.13, 0.1538, 71, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "compiled", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " compiled = _replacement_cache.get(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L627_C4", "label": "if", "type": "if", "loc": [627, 628], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "vector": [4, 1, 0.9161, 0.0029, 1, 0.13, 0.2308, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if compiled is not None:\n return compiled"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L628_C8", "label": "return", "type": "return", "loc": [628, 628], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L627_C4", "vector": [13, 2, 0.9168, 0.0015, 2, 0.07, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return compiled"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L630_C4", "label": "if", "type": "if", "loc": [630, 631], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "vector": [4, 1, 0.9204, 0.0029, 1, 0.13, 0.3077, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(_replacement_cache) >= _MAXREPCACHE:\n _replacement_cache.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L631_C8", "label": "clear()", "type": "expression", "loc": [631, 631], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L630_C4", "vector": [8, 2, 0.9212, 0.0015, 2, 0.57, 0.0, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " _replacement_cache.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L633_C4", "label": "is_unicode = isinstance()", "type": "assigned_variable", "loc": [633, 633], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "vector": [14, 1, 0.9241, 0.0015, 1, 0.13, 0.3846, 445, 3, 2, 0, 0, 552, 10, 1], "semantic": {"name": "is_unicode", "arg_names": [], "import_names": [], "rhs_call_name": "isinstance", "annotation": ""}, "snippet": " is_unicode = isinstance(template, str)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L634_C4", "label": "source = _Source()", "type": "assigned_variable", "loc": [634, 634], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "vector": [14, 1, 0.9255, 0.0015, 1, 0.13, 0.4615, 703, 3, 1, 0, 0, 566, 10, 1], "semantic": {"name": "source", "arg_names": [], "import_names": [], "rhs_call_name": "_Source", "annotation": ""}, "snippet": " source = _Source(template)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L635_C4", "label": "if", "type": "if", "loc": [635, 640], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "vector": [4, 1, 0.9307, 0.0088, 1, 0.13, 0.5385, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if is_unicode:\n def make_string(char_codes):\n return \"\".join(chr(c) for c in char_codes)\n else:\n def make_string(char_codes):\n return bytes(char_codes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L636_C8", "label": "make_string", "type": "function", "loc": [636, 637], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L635_C4", "vector": [2, 2, 0.9292, 0.0029, 2, 0.85, 0.0, 714, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "make_string", "arg_names": ["char_codes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def make_string(char_codes):\n return \"\".join(chr(c) for c in char_codes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L637_C12", "label": "return", "type": "return", "loc": [637, 637], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L636_C8", "vector": [13, 3, 0.9299, 0.0015, 3, 0.55, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"\".join(chr(c) for c in char_codes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L639_C8", "label": "make_string", "type": "function", "loc": [639, 640], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L635_C4", "vector": [2, 2, 0.9336, 0.0029, 2, 0.85, 1.0, 714, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "make_string", "arg_names": ["char_codes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def make_string(char_codes):\n return bytes(char_codes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L640_C12", "label": "return", "type": "return", "loc": [640, 640], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L639_C8", "vector": [13, 3, 0.9343, 0.0015, 3, 0.08, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bytes(char_codes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L642_C4", "label": "compiled =", "type": "assigned_variable", "loc": [642, 642], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "vector": [14, 1, 0.9372, 0.0015, 1, 0.13, 0.6154, 71, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "compiled", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " compiled = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L643_C4", "label": "literal =", "type": "assigned_variable", "loc": [643, 643], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "vector": [14, 1, 0.9387, 0.0015, 1, 0.13, 0.6923, 874, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "literal", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " literal = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:While_L644_C4", "label": "while", "type": "while", "loc": [644, 662], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "vector": [5, 1, 0.9533, 0.0277, 1, 0.13, 0.7692, 0, 1, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n ch = source.get()\n if not ch:\n break\n if ch == \"\\\\\":\n # '_compile_replacement' will return either an int group reference\n # or a string literal. It returns items (plural) in order to handle\n # a 2-character literal (an invalid escape sequence)."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L645_C8", "label": "ch = get()", "type": "assigned_variable", "loc": [645, 645], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:While_L644_C4", "vector": [14, 2, 0.9416, 0.0015, 2, 0.11, 0.0, 263, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ch = source.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L646_C8", "label": "if", "type": "if", "loc": [646, 647], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:While_L644_C4", "vector": [4, 2, 0.9438, 0.0029, 2, 0.11, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not ch:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L648_C8", "label": "if", "type": "if", "loc": [648, 662], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:While_L644_C4", "vector": [4, 2, 0.9562, 0.0219, 2, 0.11, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ch == \"\\\\\":\n # '_compile_replacement' will return either an int group reference\n # or a string literal. It returns items (plural) in order to handle\n # a 2-character literal (an invalid escape sequence).\n is_group, items = _compile_replacement(source, pattern, is_unicode)\n if is_group:\n # It's a group, so first flush the literal.\n if literal:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L652_C12", "label": "is_group, items = _compile_replacement()", "type": "assigned_variable", "loc": [652, 652], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L648_C8", "vector": [14, 3, 0.9518, 0.0015, 3, 0.3, 0.0, 654, 3, 3, 0, 0, 693, 10, 1], "semantic": {"name": "is_group, items", "arg_names": [], "import_names": [], "rhs_call_name": "_compile_replacement", "annotation": ""}, "snippet": " is_group, items = _compile_replacement(source, pattern, is_unicode)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L653_C12", "label": "if", "type": "if", "loc": [653, 660], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L648_C8", "vector": [4, 3, 0.9584, 0.0117, 3, 0.3, 0.5, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if is_group:\n # It's a group, so first flush the literal.\n if literal:\n compiled.append(make_string(literal))\n literal = []\n compiled.extend(items)\n else:\n literal.extend(items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L655_C16", "label": "if", "type": "if", "loc": [655, 657], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L653_C12", "vector": [4, 4, 0.9577, 0.0044, 4, 0.71, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if literal:\n compiled.append(make_string(literal))\n literal = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L656_C20", "label": "append()", "type": "expression", "loc": [656, 656], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L655_C16", "vector": [8, 5, 0.9577, 0.0015, 5, 0.71, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " compiled.append(make_string(literal))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L657_C20", "label": "literal =", "type": "assigned_variable", "loc": [657, 657], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L655_C16", "vector": [14, 5, 0.9591, 0.0015, 5, 0.71, 1.0, 874, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "literal", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " literal = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L658_C16", "label": "extend()", "type": "expression", "loc": [658, 658], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L653_C12", "vector": [8, 4, 0.9606, 0.0015, 4, 0.71, 0.5, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " compiled.extend(items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L660_C16", "label": "extend()", "type": "expression", "loc": [660, 660], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L653_C12", "vector": [8, 4, 0.9635, 0.0015, 4, 0.71, 1.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " literal.extend(items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L662_C12", "label": "append()", "type": "expression", "loc": [662, 662], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L648_C8", "vector": [8, 3, 0.9664, 0.0015, 3, 0.3, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " literal.append(ord(ch))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L665_C4", "label": "if", "type": "if", "loc": [665, 666], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "vector": [4, 1, 0.9715, 0.0029, 1, 0.13, 0.8462, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if literal:\n compiled.append(make_string(literal))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L666_C8", "label": "append()", "type": "expression", "loc": [666, 666], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L665_C4", "vector": [8, 2, 0.9723, 0.0015, 2, 0.37, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " compiled.append(make_string(literal))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L668_C4", "label": "assign", "type": "assigned_variable", "loc": [668, 668], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "vector": [14, 1, 0.9752, 0.0015, 1, 0.13, 0.9231, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _replacement_cache[key] = compiled"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L670_C4", "label": "return", "type": "return", "loc": [670, 670], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "vector": [13, 1, 0.9781, 0.0015, 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 compiled"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L673_C0", "label": "_pattern_type = type()", "type": "assigned_variable", "loc": [673, 673], "level": 0, "parent": null, "vector": [14, 0, 0.9825, 0.0015, 0, 0.66, 0.9024, 891, 3, 1, 0, 0, 801, 10, 2], "semantic": {"name": "_pattern_type", "arg_names": [], "import_names": [], "rhs_call_name": "type", "annotation": ""}, "snippet": "_pattern_type = type(_compile(\"\", 0, {}))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L677_C0", "label": "Regex =", "type": "assigned_variable", "loc": [677, 677], "level": 0, "parent": null, "vector": [14, 0, 0.9883, 0.0015, 0, 0.66, 0.9268, 44, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Regex", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "Regex = compile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Import_L680_C0", "label": "copyreg import _copy_reg", "type": "import", "loc": [680, 680], "level": 0, "parent": null, "vector": [1, 0, 0.9927, 0.0015, 0, 0.66, 0.9512, 86, 0, 1, 0, 0, 86, 0, 0], "semantic": {"name": "copyreg", "arg_names": [], "import_names": ["_copy_reg"], "rhs_call_name": "", "annotation": ""}, "snippet": "import copyreg as _copy_reg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L682_C0", "label": "_pickle", "type": "function", "loc": [682, 683], "level": 0, "parent": null, "vector": [2, 0, 0.9964, 0.0029, 0, 0.66, 0.9756, 925, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "_pickle", "arg_names": ["p"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _pickle(p):\n return _compile, (p.pattern, p.flags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L683_C4", "label": "return", "type": "return", "loc": [683, 683], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L682_C0", "vector": [13, 1, 0.9971, 0.0015, 1, 0.89, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _compile, (p.pattern, p.flags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L685_C0", "label": "pickle()", "type": "expression", "loc": [685, 685], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0015, 0, 0.66, 1.0, 848, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "pickle", "arg_names": [], "import_names": [], "rhs_call_name": "pickle", "annotation": ""}, "snippet": "_copy_reg.pickle(_pattern_type, _pickle, _compile)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L233_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L235_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L233_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L237_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L240_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L242_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L240_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L249_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L251_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L254_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L256_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L254_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L261_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L266_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L271_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L274_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L276_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L274_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L283_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L286_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L288_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L286_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L298_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L299_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L298_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L305_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L309_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L312_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L314_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L312_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L318_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L321_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L323_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L321_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L326_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L329_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L330_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L329_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L331_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L333_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L333_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L335_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L333_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L336_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L339_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L340_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L342_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L343_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L342_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L344_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L344_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L345_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L344_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L346_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L346_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L347_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L347_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L348_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L348_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L349_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L348_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L350_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L348_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L351_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L351_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L352_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L351_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L354_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L346_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L356_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L356_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L357_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L357_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L358_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L357_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L359_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L359_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L360_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L359_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L362_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L359_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L363_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L344_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L365_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L344_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L367_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L344_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L368_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L368_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L369_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L369_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L370_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L370_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L371_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L370_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L372_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L370_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L373_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L373_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L374_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L373_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L376_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L368_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L378_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L378_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L379_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L379_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L380_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L379_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L381_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L381_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L382_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L381_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L384_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L381_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L385_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L344_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L387_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L425_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L428_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L431_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L432_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L432_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L434_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L432_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L437_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L439_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L439_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L440_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L440_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L442_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L440_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L443_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L440_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L446_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L440_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L447_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L447_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L448_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L448_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L449_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L449_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L450_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L440_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L454_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L440_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L457_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L440_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L459_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L465_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L465_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L466_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L465_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L467_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L467_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L468_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L467_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L469_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L469_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L470_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L469_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L473_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L478_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L480_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L481_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:While_L483_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:While_L483_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L484_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L484_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L485_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L484_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L486_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L484_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L487_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L484_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L488_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L484_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L489_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L484_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L493_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L484_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L495_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:While_L483_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L497_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L501_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L505_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L506_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L509_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L512_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L515_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L515_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L516_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L521_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L522_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L525_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L528_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L528_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L529_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L532_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L535_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L536_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L539_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L542_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L543_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L544_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L545_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L545_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L546_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L545_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L547_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L545_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L548_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L548_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L549_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L548_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L551_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L545_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L552_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L545_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L553_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L545_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L554_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L557_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L560_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L563_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L564_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L565_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L565_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L566_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:For_L572_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L576_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L578_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L578_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L580_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L580_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L581_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L580_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L582_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:Try_L580_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L583_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L588_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L595_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L600_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L600_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L602_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L604_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L604_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L605_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L605_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L606_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L604_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L608_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L604_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L611_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L604_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L613_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L604_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L616_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L618_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L621_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L625_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L626_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L627_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L627_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L628_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L630_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L630_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L631_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L633_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L634_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L635_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L635_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L636_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L636_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L637_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L635_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L639_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L639_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L640_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L642_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L643_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:While_L644_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:While_L644_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L645_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:While_L644_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L646_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:While_L644_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L648_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L648_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L652_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L648_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L653_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L653_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L655_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L655_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L656_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L655_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L657_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L653_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L658_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L653_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L660_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L648_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L662_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L665_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:If_L665_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Expr_L666_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Assign_L668_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L620_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L670_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1390:FunctionDef_L682_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1390:Return_L683_C4"}] |
#!/usr/bin/env python
import os
import sys
from distutils.core import setup, Extension
MAJOR, MINOR = sys.version_info[:2]
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
PKG_BASE = 'Python%i' % MAJOR
DOCS_DIR = os.path.join(BASE_DIR, 'docs')
setup(
name='regex',
version='2014.12.24',
description='Alternative regular expression module, to replace re.',
long_description=open(os.path.join(DOCS_DIR, 'Features.rst')).read(),
# PyPI does spam protection on email addresses, no need to do it here
author='Matthew Barnett',
author_email='regex@mrabarnett.plus.com',
maintainer='Matthew Barnett',
maintainer_email='regex@mrabarnett.plus.com',
url='https://code.google.com/p/mrab-regex-hg/',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: Python Software Foundation License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.5',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.1',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Text Processing',
'Topic :: Text Processing :: General',
],
license='Python Software Foundation License',
py_modules = ['regex', '_regex_core', 'test_regex'],
package_dir={'': PKG_BASE},
ext_modules=[Extension('_regex', [os.path.join(PKG_BASE, '_regex.c'),
os.path.join(PKG_BASE, '_regex_unicode.c')])],
)
| ajibawa-2023/Python-Code-Large/train/row_1391 | 8 | 52 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1391:Import_L3_C0", "label": "os import os", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0577, 0.0192, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1391:Import_L4_C0", "label": "sys import sys", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0192, 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_1391:ImportFrom_L6_C0", "label": "from distutils.core import setup, Extension", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1154, 0.0192, 0, 0.66, 0.2857, 152, 0, 2, 0, 0, 152, 0, 0], "semantic": {"name": "distutils.core", "arg_names": [], "import_names": ["setup", "Extension"], "rhs_call_name": "", "annotation": ""}, "snippet": "from distutils.core import setup, Extension"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1391:Assign_L8_C0", "label": "MAJOR, MINOR =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.1538, 0.0192, 0, 0.66, 0.4286, 411, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "MAJOR, MINOR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MAJOR, MINOR = sys.version_info[:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1391:Assign_L9_C0", "label": "BASE_DIR = dirname()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.1731, 0.0192, 0, 0.66, 0.5714, 762, 3, 1, 0, 0, 959, 10, 2], "semantic": {"name": "BASE_DIR", "arg_names": [], "import_names": [], "rhs_call_name": "dirname", "annotation": ""}, "snippet": "BASE_DIR = os.path.dirname(os.path.abspath(__file__))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1391:Assign_L11_C0", "label": "PKG_BASE =", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.2115, 0.0192, 0, 0.66, 0.7143, 106, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "PKG_BASE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "PKG_BASE = 'Python%i' % MAJOR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1391:Assign_L12_C0", "label": "DOCS_DIR = join()", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.2308, 0.0192, 0, 0.66, 0.8571, 394, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "DOCS_DIR", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "DOCS_DIR = os.path.join(BASE_DIR, 'docs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1391:Expr_L14_C0", "label": "setup()", "type": "expression", "loc": [14, 52], "level": 0, "parent": null, "vector": [8, 0, 0.6346, 0.75, 0, 0.66, 1.0, 234, 3, 14, 0, 0, 0, 0, 7], "semantic": {"name": "setup", "arg_names": [], "import_names": [], "rhs_call_name": "setup", "annotation": ""}, "snippet": "setup(\n name='regex',\n version='2014.12.24',\n description='Alternative regular expression module, to replace re.',\n long_description=open(os.path.join(DOCS_DIR, 'Features.rst')).read(),\n\n # PyPI does spam protection on email addresses, no need to do it here\n author='Matthew Barnett',"}] | [] |
#!/usr/bin/python
# Copyright 2011 Google, Inc. All Rights Reserved.
# simple script to walk source tree looking for third-party licenses
# dumps resulting html page to stdout
import os, re, mimetypes, sys
# read source directories to scan from command line
SOURCE = sys.argv[1:]
# regex to find /* */ style comment blocks
COMMENT_BLOCK = re.compile(r"(/\*.+?\*/)", re.MULTILINE | re.DOTALL)
# regex used to detect if comment block is a license
COMMENT_LICENSE = re.compile(r"(license)", re.IGNORECASE)
COMMENT_COPYRIGHT = re.compile(r"(copyright)", re.IGNORECASE)
EXCLUDE_TYPES = [
"application/xml",
"image/png",
]
# list of known licenses; keys are derived by stripping all whitespace and
# forcing to lowercase to help combine multiple files that have same license.
KNOWN_LICENSES = {}
class License:
def __init__(self, license_text):
self.license_text = license_text
self.filenames = []
# add filename to the list of files that have the same license text
def add_file(self, filename):
if filename not in self.filenames:
self.filenames.append(filename)
LICENSE_KEY = re.compile(r"[^\w]")
def find_license(license_text):
# TODO(alice): a lot these licenses are almost identical Apache licenses.
# Most of them differ in origin/modifications. Consider combining similar
# licenses.
license_key = LICENSE_KEY.sub("", license_text).lower()
if license_key not in KNOWN_LICENSES:
KNOWN_LICENSES[license_key] = License(license_text)
return KNOWN_LICENSES[license_key]
def discover_license(exact_path, filename):
# when filename ends with LICENSE, assume applies to filename prefixed
if filename.endswith("LICENSE"):
with open(exact_path) as file:
license_text = file.read()
target_filename = filename[:-len("LICENSE")]
if target_filename.endswith("."): target_filename = target_filename[:-1]
find_license(license_text).add_file(target_filename)
return None
# try searching for license blocks in raw file
mimetype = mimetypes.guess_type(filename)
if mimetype in EXCLUDE_TYPES: return None
with open(exact_path) as file:
raw_file = file.read()
# include comments that have both "license" and "copyright" in the text
for comment in COMMENT_BLOCK.finditer(raw_file):
comment = comment.group(1)
if COMMENT_LICENSE.search(comment) is None: continue
if COMMENT_COPYRIGHT.search(comment) is None: continue
find_license(comment).add_file(filename)
for source in SOURCE:
for root, dirs, files in os.walk(source):
for name in files:
discover_license(os.path.join(root, name), name)
print "<html><head><style> body { font-family: sans-serif; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; } </style></head><body>"
for license in KNOWN_LICENSES.values():
print "<h3>Notices for files:</h3><ul>"
filenames = license.filenames
filenames.sort()
for filename in filenames:
print "<li>%s</li>" % (filename)
print "</ul>"
print "<pre>%s</pre>" % license.license_text
print "</body></html>"
| ajibawa-2023/Python-Code-Large/train/row_1392 | 51 | 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_1392:Import_L8_C0", "label": "os import os, re, mimetypes\u2026", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0816, 0.0102, 0, 0.66, 0.0, 688, 0, 4, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "re", "mimetypes", "sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os, re, mimetypes, sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L12_C0", "label": "SOURCE =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.1224, 0.0102, 0, 0.66, 0.0714, 792, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "SOURCE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SOURCE = sys.argv[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L15_C0", "label": "COMMENT_BLOCK = compile()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.1531, 0.0102, 0, 0.66, 0.1429, 629, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "COMMENT_BLOCK", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "COMMENT_BLOCK = re.compile(r\"(/\\*.+?\\*/)\", re.MULTILINE | re.DOTALL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L17_C0", "label": "COMMENT_LICENSE = compile()", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.1735, 0.0102, 0, 0.66, 0.2143, 929, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "COMMENT_LICENSE", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "COMMENT_LICENSE = re.compile(r\"(license)\", re.IGNORECASE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L18_C0", "label": "COMMENT_COPYRIGHT = compile()", "type": "assigned_variable", "loc": [18, 18], "level": 0, "parent": null, "vector": [14, 0, 0.1837, 0.0102, 0, 0.66, 0.2857, 407, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "COMMENT_COPYRIGHT", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "COMMENT_COPYRIGHT = re.compile(r\"(copyright)\", re.IGNORECASE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L20_C0", "label": "EXCLUDE_TYPES =", "type": "assigned_variable", "loc": [20, 23], "level": 0, "parent": null, "vector": [14, 0, 0.2194, 0.0408, 0, 0.66, 0.3571, 265, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "EXCLUDE_TYPES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "EXCLUDE_TYPES = [\n \"application/xml\",\n \"image/png\",\n]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L28_C0", "label": "KNOWN_LICENSES =", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.2857, 0.0102, 0, 0.66, 0.4286, 144, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "KNOWN_LICENSES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "KNOWN_LICENSES = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:ClassDef_L31_C0", "label": "License", "type": "class", "loc": [31, 39], "level": 0, "parent": null, "vector": [3, 0, 0.3571, 0.0918, 0, 0.66, 0.5, 338, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "License", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class License:\n def __init__(self, license_text):\n self.license_text = license_text\n self.filenames = []\n\n # add filename to the list of files that have the same license text\n def add_file(self, filename):\n if filename not in self.filenames:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L32_C4", "label": "__init__", "type": "function", "loc": [32, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:ClassDef_L31_C0", "vector": [2, 1, 0.3367, 0.0306, 1, 0.2, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "license_text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, license_text):\n self.license_text = license_text\n self.filenames = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L33_C8", "label": "self.license_text =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L32_C4", "vector": [14, 2, 0.3367, 0.0102, 2, 0.41, 0.0, 103, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.license_text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.license_text = license_text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L34_C8", "label": "self.filenames =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L32_C4", "vector": [14, 2, 0.3469, 0.0102, 2, 0.41, 1.0, 866, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.filenames", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.filenames = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L37_C4", "label": "add_file", "type": "function", "loc": [37, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:ClassDef_L31_C0", "vector": [2, 1, 0.3878, 0.0306, 1, 0.2, 1.0, 369, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "add_file", "arg_names": ["self", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_file(self, filename):\n if filename not in self.filenames:\n self.filenames.append(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L38_C8", "label": "if", "type": "if", "loc": [38, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L37_C4", "vector": [4, 2, 0.3929, 0.0204, 2, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if filename not in self.filenames:\n self.filenames.append(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L39_C12", "label": "append()", "type": "expression", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L38_C8", "vector": [8, 3, 0.398, 0.0102, 3, 0.4, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.filenames.append(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L42_C0", "label": "LICENSE_KEY = compile()", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.4286, 0.0102, 0, 0.66, 0.5714, 222, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "LICENSE_KEY", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "LICENSE_KEY = re.compile(r\"[^\\w]\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L44_C0", "label": "find_license", "type": "function", "loc": [44, 51], "level": 0, "parent": null, "vector": [2, 0, 0.4847, 0.0816, 0, 0.66, 0.6429, 149, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "find_license", "arg_names": ["license_text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def find_license(license_text):\n # TODO(alice): a lot these licenses are almost identical Apache licenses.\n # Most of them differ in origin/modifications. Consider combining similar\n # licenses.\n license_key = LICENSE_KEY.sub(\"\", license_text).lower()\n if license_key not in KNOWN_LICENSES:\n KNOWN_LICENSES[license_key] = License(license_text)\n return KNOWN_LICENSES[license_key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L48_C4", "label": "license_key = lower()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L44_C0", "vector": [14, 1, 0.4898, 0.0102, 1, 0.2, 0.0, 374, 3, 0, 0, 0, 432, 10, 2], "semantic": {"name": "license_key", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " license_key = LICENSE_KEY.sub(\"\", license_text).lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L49_C4", "label": "if", "type": "if", "loc": [49, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L44_C0", "vector": [4, 1, 0.5051, 0.0204, 1, 0.2, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if license_key not in KNOWN_LICENSES:\n KNOWN_LICENSES[license_key] = License(license_text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L50_C8", "label": " = License()", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L49_C4", "vector": [14, 2, 0.5102, 0.0102, 2, 0.43, 0.0, 0, 3, 1, 0, 0, 338, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "License", "annotation": ""}, "snippet": " KNOWN_LICENSES[license_key] = License(license_text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Return_L51_C4", "label": "return", "type": "return", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L44_C0", "vector": [13, 1, 0.5204, 0.0102, 1, 0.2, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return KNOWN_LICENSES[license_key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L55_C0", "label": "discover_license", "type": "function", "loc": [55, 77], "level": 0, "parent": null, "vector": [2, 0, 0.6735, 0.2347, 0, 0.66, 0.7143, 17, 0, 2, 1, 0, 0, 0, 16], "semantic": {"name": "discover_license", "arg_names": ["exact_path", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def discover_license(exact_path, filename):\n # when filename ends with LICENSE, assume applies to filename prefixed\n if filename.endswith(\"LICENSE\"):\n with open(exact_path) as file:\n license_text = file.read()\n target_filename = filename[:-len(\"LICENSE\")]\n if target_filename.endswith(\".\"): target_filename = target_filename[:-1]\n find_license(license_text).add_file(target_filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L57_C4", "label": "if", "type": "if", "loc": [57, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L55_C0", "vector": [4, 1, 0.6122, 0.0714, 1, 0.02, 0.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if filename.endswith(\"LICENSE\"):\n with open(exact_path) as file:\n license_text = file.read()\n target_filename = filename[:-len(\"LICENSE\")]\n if target_filename.endswith(\".\"): target_filename = target_filename[:-1]\n find_license(license_text).add_file(target_filename)\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L59_C12", "label": "license_text = read()", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L57_C4", "vector": [14, 2, 0.602, 0.0102, 2, 0.12, 0.0, 550, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "license_text", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " license_text = file.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L60_C8", "label": "target_filename =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L57_C4", "vector": [14, 2, 0.6122, 0.0102, 2, 0.12, 0.0, 439, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "target_filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " target_filename = filename[:-len(\"LICENSE\")]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L61_C8", "label": "if", "type": "if", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L57_C4", "vector": [4, 2, 0.6224, 0.0102, 2, 0.12, 0.3333, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if target_filename.endswith(\".\"): target_filename = target_filename[:-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L61_C42", "label": "target_filename =", "type": "assigned_variable", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L61_C8", "vector": [14, 3, 0.6224, 0.0102, 3, 0.47, 0.0, 439, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "target_filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if target_filename.endswith(\".\"): target_filename = target_filename[:-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L62_C8", "label": "add_file()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L57_C4", "vector": [8, 2, 0.6327, 0.0102, 2, 0.12, 0.6667, 369, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "add_file", "arg_names": [], "import_names": [], "rhs_call_name": "add_file", "annotation": ""}, "snippet": " find_license(license_text).add_file(target_filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Return_L63_C8", "label": "return", "type": "return", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L57_C4", "vector": [13, 2, 0.6429, 0.0102, 2, 0.12, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L66_C4", "label": "mimetype = guess_type()", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L55_C0", "vector": [14, 1, 0.6735, 0.0102, 1, 0.02, 0.3333, 290, 3, 1, 0, 0, 213, 10, 1], "semantic": {"name": "mimetype", "arg_names": [], "import_names": [], "rhs_call_name": "guess_type", "annotation": ""}, "snippet": " mimetype = mimetypes.guess_type(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L67_C4", "label": "if", "type": "if", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L55_C0", "vector": [4, 1, 0.6837, 0.0102, 1, 0.02, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if mimetype in EXCLUDE_TYPES: return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Return_L67_C34", "label": "return", "type": "return", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L67_C4", "vector": [13, 2, 0.6837, 0.0102, 2, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if mimetype in EXCLUDE_TYPES: return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L70_C8", "label": "raw_file = read()", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L55_C0", "vector": [14, 1, 0.7143, 0.0102, 1, 0.02, 0.0, 1, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "raw_file", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " raw_file = file.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L73_C4", "label": "for comment", "type": "for", "loc": [73, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L55_C0", "vector": [6, 1, 0.7653, 0.051, 1, 0.02, 1.0, 34, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "comment", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for comment in COMMENT_BLOCK.finditer(raw_file):\n comment = comment.group(1)\n if COMMENT_LICENSE.search(comment) is None: continue\n if COMMENT_COPYRIGHT.search(comment) is None: continue\n find_license(comment).add_file(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L74_C8", "label": "comment = group()", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L73_C4", "vector": [14, 2, 0.7551, 0.0102, 2, 0.97, 0.0, 34, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "comment", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": " comment = comment.group(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L75_C8", "label": "if", "type": "if", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L73_C4", "vector": [4, 2, 0.7653, 0.0102, 2, 0.97, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if COMMENT_LICENSE.search(comment) is None: continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L76_C8", "label": "if", "type": "if", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L73_C4", "vector": [4, 2, 0.7755, 0.0102, 2, 0.97, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if COMMENT_COPYRIGHT.search(comment) is None: continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L77_C8", "label": "add_file()", "type": "expression", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L73_C4", "vector": [8, 2, 0.7857, 0.0102, 2, 0.97, 1.0, 369, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "add_file", "arg_names": [], "import_names": [], "rhs_call_name": "add_file", "annotation": ""}, "snippet": " find_license(comment).add_file(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L80_C0", "label": "for source", "type": "for", "loc": [80, 83], "level": 0, "parent": null, "vector": [6, 0, 0.8316, 0.0408, 0, 0.66, 0.7857, 703, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "source", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for source in SOURCE:\n for root, dirs, files in os.walk(source):\n for name in files:\n discover_license(os.path.join(root, name), name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L81_C4", "label": "for root, dirs, files", "type": "for", "loc": [81, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L80_C0", "vector": [6, 1, 0.8367, 0.0306, 1, 0.21, 0.0, 129, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "root, dirs, files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for root, dirs, files in os.walk(source):\n for name in files:\n discover_license(os.path.join(root, name), name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L82_C8", "label": "for name", "type": "for", "loc": [82, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L81_C4", "vector": [6, 2, 0.8418, 0.0204, 2, 0.79, 0.0, 57, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name in files:\n discover_license(os.path.join(root, name), name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L83_C12", "label": "discover_license()", "type": "expression", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L82_C8", "vector": [8, 3, 0.8469, 0.0102, 3, 0.34, 0.0, 17, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "discover_license", "arg_names": [], "import_names": [], "rhs_call_name": "discover_license", "annotation": ""}, "snippet": " discover_license(os.path.join(root, name), name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L86_C0", "label": "print()", "type": "expression", "loc": [86, 86], "level": 0, "parent": null, "vector": [8, 0, 0.8776, 0.0102, 0, 0.66, 0.8571, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"<html><head><style> body { font-family: sans-serif; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; } </style></head><body>\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L88_C0", "label": "for license", "type": "for", "loc": [88, 96], "level": 0, "parent": null, "vector": [6, 0, 0.9388, 0.0918, 0, 0.66, 0.9286, 365, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "license", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for license in KNOWN_LICENSES.values():\n\n print(\"<h3>Notices for files:</h3><ul>\")\n filenames = license.filenames\n filenames.sort()\n for filename in filenames:\n print(\"<li>%s</li>\" % (filename))\n print(\"</ul>\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L90_C4", "label": "print()", "type": "expression", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L88_C0", "vector": [8, 1, 0.9184, 0.0102, 1, 0.67, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"<h3>Notices for files:</h3><ul>\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L91_C4", "label": "filenames =", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L88_C0", "vector": [14, 1, 0.9286, 0.0102, 1, 0.67, 0.2, 94, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "filenames", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filenames = license.filenames"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L92_C4", "label": "sort()", "type": "expression", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L88_C0", "vector": [8, 1, 0.9388, 0.0102, 1, 0.67, 0.4, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " filenames.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L93_C4", "label": "for filename", "type": "for", "loc": [93, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L88_C0", "vector": [6, 1, 0.9541, 0.0204, 1, 0.67, 0.6, 275, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for filename in filenames:\n print(\"<li>%s</li>\" % (filename))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L94_C8", "label": "print()", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L93_C4", "vector": [8, 2, 0.9592, 0.0102, 2, 0.0, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"<li>%s</li>\" % (filename))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L95_C4", "label": "print()", "type": "expression", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L88_C0", "vector": [8, 1, 0.9694, 0.0102, 1, 0.67, 0.8, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"</ul>\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L96_C4", "label": "print()", "type": "expression", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L88_C0", "vector": [8, 1, 0.9796, 0.0102, 1, 0.67, 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>%s</pre>\" % license.license_text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L98_C0", "label": "print()", "type": "expression", "loc": [98, 98], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0102, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"</body></html>\")"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1392:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Return_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L61_C42"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Return_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Return_L67_C34"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:If_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L83_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1392:For_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1392:Expr_L96_C4"}] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2012 Zdenko Podobný
# Author: Zdenko Podobný
#
# 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.
"""
Simple python demo script of tesseract-ocr 3.02 c-api
"""
import os
import sys
import ctypes
# Demo variables
lang = "eng"
filename = "../phototest.tif"
libpath = "/usr/local/lib64/"
libpath_w = "../vs2008/DLL_Release/"
TESSDATA_PREFIX = os.environ.get('TESSDATA_PREFIX')
if not TESSDATA_PREFIX:
TESSDATA_PREFIX = "../"
if sys.platform == "win32":
libname = libpath_w + "libtesseract302.dll"
libname_alt = "libtesseract302.dll"
os.environ["PATH"] += os.pathsep + libpath_w
else:
libname = libpath + "libtesseract.so.3.0.2"
libname_alt = "libtesseract.so.3"
try:
tesseract = ctypes.cdll.LoadLibrary(libname)
except:
try:
tesseract = ctypes.cdll.LoadLibrary(libname_alt)
except WindowsError, err:
print("Trying to load '%s'..." % libname)
print("Trying to load '%s'..." % libname_alt)
print(err)
exit(1)
tesseract.TessVersion.restype = ctypes.c_char_p
tesseract_version = tesseract.TessVersion()[:4]
# We need to check library version because libtesseract.so.3 is symlink
# and can point to other version than 3.02
if float(tesseract_version) < 3.02:
print("Found tesseract-ocr library version %s." % tesseract_version)
print("C-API is present only in version 3.02!")
exit(2)
api = tesseract.TessBaseAPICreate()
rc = tesseract.TessBaseAPIInit3(api, TESSDATA_PREFIX, lang);
if (rc):
tesseract.TessBaseAPIDelete(api)
print("Could not initialize tesseract.\n")
exit(3)
text_out = tesseract.TessBaseAPIProcessPages(api, filename, None , 0);
result_text = ctypes.string_at(text_out)
print result_text
| ajibawa-2023/Python-Code-Large/train/row_1395 | 3 | 4 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1395:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.25, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1395:Import_L2_C0", "label": "sys import sys", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.25, 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_1395:Import_L3_C0", "label": "ctypes import ctypes", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.75, 0.25, 0, 0.66, 1.0, 182, 0, 1, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["ctypes"], "rhs_call_name": "", "annotation": ""}, "snippet": "import ctypes"}] | [] |
'''
Created on Feb 3, 2013
@author: bawey
'''
import cpoo_tools as tools
import cv
import cv2
import numpy as np
import sys
import tesseract
from cpoo_tools import show_wait
image = cv.LoadImage( sys.argv[1] )
image = tools.split_channels( image )
resized = cv.CreateImage( ( ( int )( image.width * ( 640.0 / image.height ) ), 640 ), image.depth, image.nChannels )
cv.Resize( image, resized )
image = resized
image = tools.array2cv( cv2.medianBlur( tools.cv2array( image ), 3 ) )
tools.show_wait( image, "cpoo" )
output = tools.text_energy_map( image )
tools.show_wait( output, "cpoo" )
regions = tools.grow_regions( output, 255, 0 )
regions = tools.cluster_regions( image, regions )
regions = tools.kill_the_losers( image, regions )
api = tesseract.TessBaseAPI()
api.Init( ".", "eng", tesseract.OEM_TESSERACT_ONLY )
api.SetVariable( "tessedit_char_whitelist", " 0123456789.:\/\\PM" )
api.SetPageSegMode( tesseract.PSM_SINGLE_LINE )
for region in regions:
roi_image = tools.extract( image, region )
result = cv.CreateImage( ( 2 * roi_image.width, 2 * roi_image.height ), roi_image.depth, roi_image.nChannels )
cv.Resize( roi_image, result )
tools.show_wait( result, "final result" )
cv.SaveImage("result.png", result)
tesseract.SetCvImage( result, api )
text = api.GetUTF8Text()
print "scanned text: " + text
| ajibawa-2023/Python-Code-Large/train/row_1396 | 33 | 51 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0588, 0.098, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nCreated on Feb 3, 2013\n\n@author: bawey\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Import_L8_C0", "label": "cpoo_tools import tools", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.1569, 0.0196, 0, 0.66, 0.0417, 991, 0, 1, 0, 0, 991, 0, 0], "semantic": {"name": "cpoo_tools", "arg_names": [], "import_names": ["tools"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cpoo_tools as tools"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Import_L9_C0", "label": "cv import cv", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1765, 0.0196, 0, 0.66, 0.0833, 492, 0, 1, 0, 0, 492, 0, 0], "semantic": {"name": "cv", "arg_names": [], "import_names": ["cv"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Import_L10_C0", "label": "cv2 import cv2", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1961, 0.0196, 0, 0.66, 0.125, 896, 0, 1, 0, 0, 896, 0, 0], "semantic": {"name": "cv2", "arg_names": [], "import_names": ["cv2"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cv2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Import_L11_C0", "label": "numpy import np", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.2157, 0.0196, 0, 0.66, 0.1667, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Import_L12_C0", "label": "sys import sys", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.2353, 0.0196, 0, 0.66, 0.2083, 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_1396:Import_L13_C0", "label": "tesseract import tesseract", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.2549, 0.0196, 0, 0.66, 0.25, 332, 0, 1, 0, 0, 332, 0, 0], "semantic": {"name": "tesseract", "arg_names": [], "import_names": ["tesseract"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tesseract"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:ImportFrom_L14_C0", "label": "from cpoo_tools import show_wait", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.2745, 0.0196, 0, 0.66, 0.2917, 991, 0, 1, 0, 0, 991, 0, 0], "semantic": {"name": "cpoo_tools", "arg_names": [], "import_names": ["show_wait"], "rhs_call_name": "", "annotation": ""}, "snippet": "from cpoo_tools import show_wait"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Assign_L17_C0", "label": "image = LoadImage()", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.3333, 0.0196, 0, 0.66, 0.3333, 505, 3, 1, 0, 0, 512, 10, 1], "semantic": {"name": "image", "arg_names": [], "import_names": [], "rhs_call_name": "LoadImage", "annotation": ""}, "snippet": "image = cv.LoadImage( sys.argv[1] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Assign_L19_C0", "label": "image = split_channels()", "type": "assigned_variable", "loc": [19, 19], "level": 0, "parent": null, "vector": [14, 0, 0.3725, 0.0196, 0, 0.66, 0.375, 505, 3, 1, 0, 0, 571, 10, 1], "semantic": {"name": "image", "arg_names": [], "import_names": [], "rhs_call_name": "split_channels", "annotation": ""}, "snippet": "image = tools.split_channels( image )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Assign_L20_C0", "label": "resized = CreateImage()", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.3922, 0.0196, 0, 0.66, 0.4167, 232, 3, 3, 0, 0, 288, 10, 2], "semantic": {"name": "resized", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": "resized = cv.CreateImage( ( ( int )( image.width * ( 640.0 / image.height ) ), 640 ), image.depth, image.nChannels )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Expr_L21_C0", "label": "Resize()", "type": "expression", "loc": [21, 21], "level": 0, "parent": null, "vector": [8, 0, 0.4118, 0.0196, 0, 0.66, 0.4583, 430, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Resize", "arg_names": [], "import_names": [], "rhs_call_name": "Resize", "annotation": ""}, "snippet": "cv.Resize( image, resized )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Assign_L22_C0", "label": "image =", "type": "assigned_variable", "loc": [22, 22], "level": 0, "parent": null, "vector": [14, 0, 0.4314, 0.0196, 0, 0.66, 0.5, 505, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "image", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "image = resized"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Assign_L23_C0", "label": "image = array2cv()", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.451, 0.0196, 0, 0.66, 0.5417, 505, 3, 1, 0, 0, 769, 10, 3], "semantic": {"name": "image", "arg_names": [], "import_names": [], "rhs_call_name": "array2cv", "annotation": ""}, "snippet": "image = tools.array2cv( cv2.medianBlur( tools.cv2array( image ), 3 ) ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Expr_L24_C0", "label": "show_wait()", "type": "expression", "loc": [24, 24], "level": 0, "parent": null, "vector": [8, 0, 0.4706, 0.0196, 0, 0.66, 0.5833, 33, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "show_wait", "arg_names": [], "import_names": [], "rhs_call_name": "show_wait", "annotation": ""}, "snippet": "tools.show_wait( image, \"cpoo\" )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Assign_L26_C0", "label": "output = text_energy_map()", "type": "assigned_variable", "loc": [26, 26], "level": 0, "parent": null, "vector": [14, 0, 0.5098, 0.0196, 0, 0.66, 0.625, 886, 3, 1, 0, 0, 235, 10, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "text_energy_map", "annotation": ""}, "snippet": "output = tools.text_energy_map( image )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Expr_L28_C0", "label": "show_wait()", "type": "expression", "loc": [28, 28], "level": 0, "parent": null, "vector": [8, 0, 0.549, 0.0196, 0, 0.66, 0.6667, 33, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "show_wait", "arg_names": [], "import_names": [], "rhs_call_name": "show_wait", "annotation": ""}, "snippet": "tools.show_wait( output, \"cpoo\" )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Assign_L30_C0", "label": "regions = grow_regions()", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.5882, 0.0196, 0, 0.66, 0.7083, 801, 3, 3, 0, 0, 874, 10, 1], "semantic": {"name": "regions", "arg_names": [], "import_names": [], "rhs_call_name": "grow_regions", "annotation": ""}, "snippet": "regions = tools.grow_regions( output, 255, 0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Assign_L31_C0", "label": "regions = cluster_regions()", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.6078, 0.0196, 0, 0.66, 0.75, 801, 3, 2, 0, 0, 202, 10, 1], "semantic": {"name": "regions", "arg_names": [], "import_names": [], "rhs_call_name": "cluster_regions", "annotation": ""}, "snippet": "regions = tools.cluster_regions( image, regions )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Assign_L32_C0", "label": "regions = kill_the_losers()", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.6275, 0.0196, 0, 0.66, 0.7917, 801, 3, 2, 0, 0, 559, 10, 1], "semantic": {"name": "regions", "arg_names": [], "import_names": [], "rhs_call_name": "kill_the_losers", "annotation": ""}, "snippet": "regions = tools.kill_the_losers( image, regions )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Assign_L34_C0", "label": "api = TessBaseAPI()", "type": "assigned_variable", "loc": [34, 34], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0196, 0, 0.66, 0.8333, 976, 3, 0, 0, 0, 49, 10, 1], "semantic": {"name": "api", "arg_names": [], "import_names": [], "rhs_call_name": "TessBaseAPI", "annotation": ""}, "snippet": "api = tesseract.TessBaseAPI()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Expr_L35_C0", "label": "Init()", "type": "expression", "loc": [35, 35], "level": 0, "parent": null, "vector": [8, 0, 0.6863, 0.0196, 0, 0.66, 0.875, 44, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "Init", "arg_names": [], "import_names": [], "rhs_call_name": "Init", "annotation": ""}, "snippet": "api.Init( \".\", \"eng\", tesseract.OEM_TESSERACT_ONLY )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Expr_L36_C0", "label": "SetVariable()", "type": "expression", "loc": [36, 36], "level": 0, "parent": null, "vector": [8, 0, 0.7059, 0.0196, 0, 0.66, 0.9167, 94, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "SetVariable", "arg_names": [], "import_names": [], "rhs_call_name": "SetVariable", "annotation": ""}, "snippet": "api.SetVariable( \"tessedit_char_whitelist\", \" 0123456789.:\\/\\\\PM\" )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Expr_L37_C0", "label": "SetPageSegMode()", "type": "expression", "loc": [37, 37], "level": 0, "parent": null, "vector": [8, 0, 0.7255, 0.0196, 0, 0.66, 0.9583, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "SetPageSegMode", "arg_names": [], "import_names": [], "rhs_call_name": "SetPageSegMode", "annotation": ""}, "snippet": "api.SetPageSegMode( tesseract.PSM_SINGLE_LINE )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:For_L40_C0", "label": "for region", "type": "for", "loc": [40, 50], "level": 0, "parent": null, "vector": [6, 0, 0.8824, 0.2157, 0, 0.66, 1.0, 814, 2, 0, 0, 0, 0, 0, 8], "semantic": {"name": "region", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for region in regions:\n roi_image = tools.extract( image, region )\n\n result = cv.CreateImage( ( 2 * roi_image.width, 2 * roi_image.height ), roi_image.depth, roi_image.nChannels )\n cv.Resize( roi_image, result )\n tools.show_wait( result, \"final result\" )\n cv.SaveImage(\"result.png\", result)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Assign_L41_C4", "label": "roi_image = extract()", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1396:For_L40_C0", "vector": [14, 1, 0.8039, 0.0196, 1, 0.61, 0.0, 609, 3, 2, 0, 0, 450, 10, 1], "semantic": {"name": "roi_image", "arg_names": [], "import_names": [], "rhs_call_name": "extract", "annotation": ""}, "snippet": " roi_image = tools.extract( image, region )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Assign_L43_C4", "label": "result = CreateImage()", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1396:For_L40_C0", "vector": [14, 1, 0.8431, 0.0196, 1, 0.61, 0.1429, 51, 3, 3, 0, 0, 288, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " result = cv.CreateImage( ( 2 * roi_image.width, 2 * roi_image.height ), roi_image.depth, roi_image.nChannels )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Expr_L44_C4", "label": "Resize()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1396:For_L40_C0", "vector": [8, 1, 0.8627, 0.0196, 1, 0.61, 0.2857, 430, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Resize", "arg_names": [], "import_names": [], "rhs_call_name": "Resize", "annotation": ""}, "snippet": " cv.Resize( roi_image, result )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Expr_L45_C4", "label": "show_wait()", "type": "expression", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1396:For_L40_C0", "vector": [8, 1, 0.8824, 0.0196, 1, 0.61, 0.4286, 33, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "show_wait", "arg_names": [], "import_names": [], "rhs_call_name": "show_wait", "annotation": ""}, "snippet": " tools.show_wait( result, \"final result\" )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Expr_L46_C4", "label": "SaveImage()", "type": "expression", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1396:For_L40_C0", "vector": [8, 1, 0.902, 0.0196, 1, 0.61, 0.5714, 91, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "SaveImage", "arg_names": [], "import_names": [], "rhs_call_name": "SaveImage", "annotation": ""}, "snippet": " cv.SaveImage(\"result.png\", result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Expr_L48_C4", "label": "SetCvImage()", "type": "expression", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1396:For_L40_C0", "vector": [8, 1, 0.9412, 0.0196, 1, 0.61, 0.7143, 868, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "SetCvImage", "arg_names": [], "import_names": [], "rhs_call_name": "SetCvImage", "annotation": ""}, "snippet": " tesseract.SetCvImage( result, api )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Assign_L49_C4", "label": "text = GetUTF8Text()", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1396:For_L40_C0", "vector": [14, 1, 0.9608, 0.0196, 1, 0.61, 0.8571, 439, 3, 0, 0, 0, 633, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "GetUTF8Text", "annotation": ""}, "snippet": " text = api.GetUTF8Text()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1396:Expr_L50_C4", "label": "print()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1396:For_L40_C0", "vector": [8, 1, 0.9804, 0.0196, 1, 0.61, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"scanned text: \" + text)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1396:For_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1396:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1396:For_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1396:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1396:For_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1396:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1396:For_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1396:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1396:For_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1396:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1396:For_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1396:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1396:For_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1396:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1396:For_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1396:Expr_L50_C4"}] |
import cv2
import cv
import sys
import cpoo_tools as tools
import numpy as np
image = cv.LoadImage( sys.argv[1] )
# tools.grow_region(image)
# TODO: set radius dynamically
img = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )
img = tools.split_channels( image )
img = tools.array2cv( cv2.GaussianBlur( tools.cv2array( img ), ( 5, 5 ), 5 ) )
entropies = tools.entropy( img[:, img.width / 2:] )
for i in range( 10, -1, -1 ):
entropies[len( entropies ) - 1 - i] = entropies[len( entropies ) - 2 - i]
entropies[i] = entropies[i + 1]
# print entropies
diffs = tools.derivative_of_vector( entropies, 1 )
ind_min = diffs.index( min( diffs ) )
ind_max = diffs.index( max( diffs ) )
print "Clipping zone: " + str( ind_max ) + "-" + str( ind_min ) + ", values: " + str( diffs[ind_max] ) + ", " + str( diffs[ind_min] )
# print diffs
clipped = tools.cropImage( image, 0, min( ind_max, ind_min ), image.width, max( ind_max, ind_min ) )
cv.ShowImage( "clipped", clipped )
cv.WaitKey()
regions = cv.CreateImage( cv.GetSize( clipped ), clipped.depth, clipped.nChannels )
tools.grow_regions( clipped )
# cv.WaitKey
| ajibawa-2023/Python-Code-Large/train/row_1397 | 22 | 39 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Import_L1_C0", "label": "cv2 import cv2", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0256, 0.0256, 0, 0.66, 0.0, 896, 0, 1, 0, 0, 896, 0, 0], "semantic": {"name": "cv2", "arg_names": [], "import_names": ["cv2"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cv2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Import_L2_C0", "label": "cv import cv", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0513, 0.0256, 0, 0.66, 0.0526, 492, 0, 1, 0, 0, 492, 0, 0], "semantic": {"name": "cv", "arg_names": [], "import_names": ["cv"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0256, 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_1397:Import_L4_C0", "label": "cpoo_tools import tools", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1026, 0.0256, 0, 0.66, 0.1579, 991, 0, 1, 0, 0, 991, 0, 0], "semantic": {"name": "cpoo_tools", "arg_names": [], "import_names": ["tools"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cpoo_tools as tools"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Import_L5_C0", "label": "numpy import np", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1282, 0.0256, 0, 0.66, 0.2105, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Assign_L7_C0", "label": "image = LoadImage()", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.1795, 0.0256, 0, 0.66, 0.2632, 505, 3, 1, 0, 0, 512, 10, 1], "semantic": {"name": "image", "arg_names": [], "import_names": [], "rhs_call_name": "LoadImage", "annotation": ""}, "snippet": "image = cv.LoadImage( sys.argv[1] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Assign_L12_C0", "label": "img = CreateImage()", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.3077, 0.0256, 0, 0.66, 0.3158, 200, 3, 3, 0, 0, 288, 10, 2], "semantic": {"name": "img", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": "img = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Assign_L13_C0", "label": "img = split_channels()", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.3333, 0.0256, 0, 0.66, 0.3684, 200, 3, 1, 0, 0, 571, 10, 1], "semantic": {"name": "img", "arg_names": [], "import_names": [], "rhs_call_name": "split_channels", "annotation": ""}, "snippet": "img = tools.split_channels( image )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Assign_L15_C0", "label": "img = array2cv()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.3846, 0.0256, 0, 0.66, 0.4211, 200, 3, 1, 0, 0, 769, 10, 3], "semantic": {"name": "img", "arg_names": [], "import_names": [], "rhs_call_name": "array2cv", "annotation": ""}, "snippet": "img = tools.array2cv( cv2.GaussianBlur( tools.cv2array( img ), ( 5, 5 ), 5 ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Assign_L16_C0", "label": "entropies = entropy()", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.4103, 0.0256, 0, 0.66, 0.4737, 411, 3, 1, 0, 0, 648, 10, 1], "semantic": {"name": "entropies", "arg_names": [], "import_names": [], "rhs_call_name": "entropy", "annotation": ""}, "snippet": "entropies = tools.entropy( img[:, img.width / 2:] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:For_L18_C0", "label": "for i", "type": "for", "loc": [18, 20], "level": 0, "parent": null, "vector": [6, 0, 0.4872, 0.0769, 0, 0.66, 0.5263, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range( 10, -1, -1 ):\n entropies[len( entropies ) - 1 - i] = entropies[len( entropies ) - 2 - i]\n entropies[i] = entropies[i + 1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Assign_L19_C4", "label": "assign", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1397:For_L18_C0", "vector": [14, 1, 0.4872, 0.0256, 1, 0.8, 0.0, 0, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " entropies[len( entropies ) - 1 - i] = entropies[len( entropies ) - 2 - i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Assign_L20_C4", "label": "assign", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1397:For_L18_C0", "vector": [14, 1, 0.5128, 0.0256, 1, 0.8, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " entropies[i] = entropies[i + 1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Assign_L24_C0", "label": "diffs = derivative_of_vector()", "type": "assigned_variable", "loc": [24, 24], "level": 0, "parent": null, "vector": [14, 0, 0.6154, 0.0256, 0, 0.66, 0.5789, 809, 3, 2, 0, 0, 146, 10, 1], "semantic": {"name": "diffs", "arg_names": [], "import_names": [], "rhs_call_name": "derivative_of_vector", "annotation": ""}, "snippet": "diffs = tools.derivative_of_vector( entropies, 1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Assign_L25_C0", "label": "ind_min = index()", "type": "assigned_variable", "loc": [25, 25], "level": 0, "parent": null, "vector": [14, 0, 0.641, 0.0256, 0, 0.66, 0.6316, 96, 3, 1, 0, 0, 780, 10, 2], "semantic": {"name": "ind_min", "arg_names": [], "import_names": [], "rhs_call_name": "index", "annotation": ""}, "snippet": "ind_min = diffs.index( min( diffs ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Assign_L26_C0", "label": "ind_max = index()", "type": "assigned_variable", "loc": [26, 26], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0256, 0, 0.66, 0.6842, 390, 3, 1, 0, 0, 780, 10, 2], "semantic": {"name": "ind_max", "arg_names": [], "import_names": [], "rhs_call_name": "index", "annotation": ""}, "snippet": "ind_max = diffs.index( max( diffs ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Expr_L28_C0", "label": "print()", "type": "expression", "loc": [28, 28], "level": 0, "parent": null, "vector": [8, 0, 0.7179, 0.0256, 0, 0.66, 0.7368, 535, 3, 1, 0, 0, 0, 0, 5], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"Clipping zone: \" + str( ind_max ) + \"-\" + str( ind_min ) + \", values: \" + str( diffs[ind_max] ) + \", \" + str( diffs[ind_min] ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Assign_L32_C0", "label": "clipped = cropImage()", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.8205, 0.0256, 0, 0.66, 0.7895, 26, 3, 5, 0, 0, 160, 10, 3], "semantic": {"name": "clipped", "arg_names": [], "import_names": [], "rhs_call_name": "cropImage", "annotation": ""}, "snippet": "clipped = tools.cropImage( image, 0, min( ind_max, ind_min ), image.width, max( ind_max, ind_min ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Expr_L33_C0", "label": "ShowImage()", "type": "expression", "loc": [33, 33], "level": 0, "parent": null, "vector": [8, 0, 0.8462, 0.0256, 0, 0.66, 0.8421, 896, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "ShowImage", "arg_names": [], "import_names": [], "rhs_call_name": "ShowImage", "annotation": ""}, "snippet": "cv.ShowImage( \"clipped\", clipped )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Expr_L34_C0", "label": "WaitKey()", "type": "expression", "loc": [34, 34], "level": 0, "parent": null, "vector": [8, 0, 0.8718, 0.0256, 0, 0.66, 0.8947, 885, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "WaitKey", "arg_names": [], "import_names": [], "rhs_call_name": "WaitKey", "annotation": ""}, "snippet": "cv.WaitKey()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Assign_L36_C0", "label": "regions = CreateImage()", "type": "assigned_variable", "loc": [36, 36], "level": 0, "parent": null, "vector": [14, 0, 0.9231, 0.0256, 0, 0.66, 0.9474, 801, 3, 3, 0, 0, 288, 10, 2], "semantic": {"name": "regions", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": "regions = cv.CreateImage( cv.GetSize( clipped ), clipped.depth, clipped.nChannels )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1397:Expr_L37_C0", "label": "grow_regions()", "type": "expression", "loc": [37, 37], "level": 0, "parent": null, "vector": [8, 0, 0.9487, 0.0256, 0, 0.66, 1.0, 874, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "grow_regions", "arg_names": [], "import_names": [], "rhs_call_name": "grow_regions", "annotation": ""}, "snippet": "tools.grow_regions( clipped )"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1397:For_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1397:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1397:For_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1397:Assign_L20_C4"}] |
"""OCR in Python using the Tesseract engine from Google
http://code.google.com/p/pytesser/
by Michael J.T. O'Kelly
V 0.0.1, 3/10/07"""
import Image
import subprocess
import util
import errors
tesseract_exe_name = 'tesseract' # Name of executable to be called at command line
scratch_image_name = "temp.bmp" # This file must be .bmp or other Tesseract-compatible format
scratch_text_name_root = "temp" # Leave out the .txt extension
cleanup_scratch_flag = True # Temporary files cleaned up after OCR operation
def call_tesseract(input_filename, output_filename):
"""Calls external tesseract.exe on input file (restrictions on types),
outputting output_filename+'txt'"""
args = [tesseract_exe_name, input_filename, output_filename]
proc = subprocess.Popen(args)
retcode = proc.wait()
if retcode!=0:
errors.check_for_errors()
def image_to_string(im, cleanup = cleanup_scratch_flag):
"""Converts im to file, applies tesseract, and fetches resulting text.
If cleanup=True, delete scratch files after operation."""
try:
util.image_to_scratch(im, scratch_image_name)
call_tesseract(scratch_image_name, scratch_text_name_root)
text = util.retrieve_text(scratch_text_name_root)
finally:
if cleanup:
util.perform_cleanup(scratch_image_name, scratch_text_name_root)
return text
def image_file_to_string(filename, cleanup = cleanup_scratch_flag, graceful_errors=True):
"""Applies tesseract to filename; or, if image is incompatible and graceful_errors=True,
converts to compatible format and then applies tesseract. Fetches resulting text.
If cleanup=True, delete scratch files after operation."""
try:
try:
call_tesseract(filename, scratch_text_name_root)
text = util.retrieve_text(scratch_text_name_root)
except errors.Tesser_General_Exception:
if graceful_errors:
im = Image.open(filename)
text = image_to_string(im, cleanup)
else:
raise
finally:
if cleanup:
util.perform_cleanup(scratch_image_name, scratch_text_name_root)
return text
if __name__=='__main__':
im = Image.open('phototest.tif')
text = image_to_string(im)
print text
try:
text = image_file_to_string('fnord.tif', graceful_errors=False)
except errors.Tesser_General_Exception, value:
print "fnord.tif is incompatible filetype. Try graceful_errors=True"
print value
text = image_file_to_string('fnord.tif', graceful_errors=True)
print "fnord.tif contents:", text
text = image_file_to_string('fonts_test.png', graceful_errors=True)
print text
| ajibawa-2023/Python-Code-Large/train/row_1398 | 32 | 47 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Import_L1_C0", "label": "Image import Image", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0213, 0.0213, 0, 0.66, 0.0, 721, 0, 1, 0, 0, 721, 0, 0], "semantic": {"name": "Image", "arg_names": [], "import_names": ["Image"], "rhs_call_name": "", "annotation": ""}, "snippet": "import Image"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Import_L2_C0", "label": "subprocess import subprocess", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0426, 0.0213, 0, 0.66, 0.1667, 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_1398:Import_L4_C0", "label": "util import util", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0851, 0.0213, 0, 0.66, 0.3333, 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_1398:Import_L5_C0", "label": "errors import errors", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1064, 0.0213, 0, 0.66, 0.5, 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_1398:FunctionDef_L7_C0", "label": "call_tesseract", "type": "function", "loc": [7, 14], "level": 0, "parent": null, "vector": [2, 0, 0.2234, 0.1702, 0, 0.66, 0.6667, 728, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "call_tesseract", "arg_names": ["input_filename", "output_filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def call_tesseract(input_filename, output_filename):\n\t\"\"\"Calls external tesseract.exe on input file (restrictions on types),\n\toutputting output_filename+'txt'\"\"\"\n\targs = [tesseract_exe_name, input_filename, output_filename]\n\tproc = subprocess.Popen(args)\n\tretcode = proc.wait()\n\tif retcode!=0:\n\t\terrors.check_for_errors()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Expr_L8_C1", "label": "expression", "type": "expression", "loc": [8, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L7_C0", "vector": [8, 1, 0.1809, 0.0426, 1, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\"\"\"Calls external tesseract.exe on input file (restrictions on types),\n\toutputting output_filename+'txt'\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Assign_L10_C1", "label": "args =", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L7_C0", "vector": [14, 1, 0.2128, 0.0213, 1, 0.05, 0.25, 805, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\targs = [tesseract_exe_name, input_filename, output_filename]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Assign_L11_C1", "label": "proc = Popen()", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L7_C0", "vector": [14, 1, 0.234, 0.0213, 1, 0.05, 0.5, 456, 3, 1, 0, 0, 568, 10, 1], "semantic": {"name": "proc", "arg_names": [], "import_names": [], "rhs_call_name": "Popen", "annotation": ""}, "snippet": "\tproc = subprocess.Popen(args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Assign_L12_C1", "label": "retcode = wait()", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L7_C0", "vector": [14, 1, 0.2553, 0.0213, 1, 0.05, 0.75, 968, 3, 0, 0, 0, 243, 10, 1], "semantic": {"name": "retcode", "arg_names": [], "import_names": [], "rhs_call_name": "wait", "annotation": ""}, "snippet": "\tretcode = proc.wait()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:If_L13_C1", "label": "if", "type": "if", "loc": [13, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L7_C0", "vector": [4, 1, 0.2872, 0.0426, 1, 0.05, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif retcode!=0:\n\t\terrors.check_for_errors()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Expr_L14_C2", "label": "check_for_errors()", "type": "expression", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:If_L13_C1", "vector": [8, 2, 0.2979, 0.0213, 2, 0.29, 0.0, 973, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "check_for_errors", "arg_names": [], "import_names": [], "rhs_call_name": "check_for_errors", "annotation": ""}, "snippet": "\t\terrors.check_for_errors()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L16_C0", "label": "image_to_string", "type": "function", "loc": [16, 26], "level": 0, "parent": null, "vector": [2, 0, 0.4468, 0.234, 0, 0.66, 0.8333, 518, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "image_to_string", "arg_names": ["im", "cleanup"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def image_to_string(im, cleanup = cleanup_scratch_flag):\n\t\"\"\"Converts im to file, applies tesseract, and fetches resulting text.\n\tIf cleanup=True, delete scratch files after operation.\"\"\"\n\ttry:\n\t\tutil.image_to_scratch(im, scratch_image_name)\n\t\tcall_tesseract(scratch_image_name, scratch_text_name_root)\n\t\ttext = util.retrieve_text(scratch_text_name_root)\n\tfinally:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Expr_L17_C1", "label": "expression", "type": "expression", "loc": [17, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L16_C0", "vector": [8, 1, 0.3723, 0.0426, 1, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\"\"\"Converts im to file, applies tesseract, and fetches resulting text.\n\tIf cleanup=True, delete scratch files after operation.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L19_C1", "label": "try", "type": "try", "loc": [19, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L16_C0", "vector": [7, 1, 0.4681, 0.1489, 1, 0.73, 0.5, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttry:\n\t\tutil.image_to_scratch(im, scratch_image_name)\n\t\tcall_tesseract(scratch_image_name, scratch_text_name_root)\n\t\ttext = util.retrieve_text(scratch_text_name_root)\n\tfinally:\n\t\tif cleanup:\n\t\t\tutil.perform_cleanup(scratch_image_name, scratch_text_name_root)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Expr_L20_C2", "label": "image_to_scratch()", "type": "expression", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L19_C1", "vector": [8, 2, 0.4255, 0.0213, 2, 0.46, 0.0, 580, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "image_to_scratch", "arg_names": [], "import_names": [], "rhs_call_name": "image_to_scratch", "annotation": ""}, "snippet": "\t\tutil.image_to_scratch(im, scratch_image_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Expr_L21_C2", "label": "call_tesseract()", "type": "expression", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L19_C1", "vector": [8, 2, 0.4468, 0.0213, 2, 0.46, 0.3333, 728, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "call_tesseract", "arg_names": [], "import_names": [], "rhs_call_name": "call_tesseract", "annotation": ""}, "snippet": "\t\tcall_tesseract(scratch_image_name, scratch_text_name_root)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Assign_L22_C2", "label": "text = retrieve_text()", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L19_C1", "vector": [14, 2, 0.4681, 0.0213, 2, 0.46, 0.6667, 439, 3, 1, 0, 0, 306, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "retrieve_text", "annotation": ""}, "snippet": "\t\ttext = util.retrieve_text(scratch_text_name_root)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:If_L24_C2", "label": "if", "type": "if", "loc": [24, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L19_C1", "vector": [4, 2, 0.5213, 0.0426, 2, 0.46, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif cleanup:\n\t\t\tutil.perform_cleanup(scratch_image_name, scratch_text_name_root)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Expr_L25_C3", "label": "perform_cleanup()", "type": "expression", "loc": [25, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:If_L24_C2", "vector": [8, 3, 0.5319, 0.0213, 3, 0.79, 0.0, 759, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "perform_cleanup", "arg_names": [], "import_names": [], "rhs_call_name": "perform_cleanup", "annotation": ""}, "snippet": "\t\t\tutil.perform_cleanup(scratch_image_name, scratch_text_name_root)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Return_L26_C1", "label": "return", "type": "return", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L16_C0", "vector": [13, 1, 0.5532, 0.0213, 1, 0.73, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L28_C0", "label": "image_file_to_string", "type": "function", "loc": [28, 45], "level": 0, "parent": null, "vector": [2, 0, 0.7766, 0.383, 0, 0.66, 1.0, 185, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "image_file_to_string", "arg_names": ["filename", "cleanup", "graceful_errors"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def image_file_to_string(filename, cleanup = cleanup_scratch_flag, graceful_errors=True):\n\t\"\"\"Applies tesseract to filename; or, if image is incompatible and graceful_errors=True,\n\tconverts to compatible format and then applies tesseract. Fetches resulting text.\n\tIf cleanup=True, delete scratch files after operation.\"\"\"\n\ttry:\n\t\ttry:\n\t\t\tcall_tesseract(filename, scratch_text_name_root)\n\t\t\ttext = util.retrieve_text(scratch_text_name_root)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Expr_L29_C1", "label": "expression", "type": "expression", "loc": [29, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L28_C0", "vector": [8, 1, 0.6383, 0.0638, 1, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\"\"\"Applies tesseract to filename; or, if image is incompatible and graceful_errors=True,\n\tconverts to compatible format and then applies tesseract. Fetches resulting text.\n\tIf cleanup=True, delete scratch files after operation.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L32_C1", "label": "try", "type": "try", "loc": [32, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L28_C0", "vector": [7, 1, 0.8085, 0.2766, 1, 0.4, 0.5, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttry:\n\t\ttry:\n\t\t\tcall_tesseract(filename, scratch_text_name_root)\n\t\t\ttext = util.retrieve_text(scratch_text_name_root)\n\t\texcept errors.Tesser_General_Exception:\n\t\t\tif graceful_errors:\n\t\t\t\tim = Image.open(filename)\n\t\t\t\ttext = image_to_string(im, cleanup)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L33_C2", "label": "try", "type": "try", "loc": [33, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L32_C1", "vector": [7, 2, 0.7872, 0.1915, 2, 0.9, 0.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ttry:\n\t\t\tcall_tesseract(filename, scratch_text_name_root)\n\t\t\ttext = util.retrieve_text(scratch_text_name_root)\n\t\texcept errors.Tesser_General_Exception:\n\t\t\tif graceful_errors:\n\t\t\t\tim = Image.open(filename)\n\t\t\t\ttext = image_to_string(im, cleanup)\n\t\t\telse:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Expr_L34_C3", "label": "call_tesseract()", "type": "expression", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L33_C2", "vector": [8, 3, 0.7234, 0.0213, 3, 0.81, 0.0, 728, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "call_tesseract", "arg_names": [], "import_names": [], "rhs_call_name": "call_tesseract", "annotation": ""}, "snippet": "\t\t\tcall_tesseract(filename, scratch_text_name_root)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Assign_L35_C3", "label": "text = retrieve_text()", "type": "assigned_variable", "loc": [35, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L33_C2", "vector": [14, 3, 0.7447, 0.0213, 3, 0.81, 1.0, 439, 3, 1, 0, 0, 306, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "retrieve_text", "annotation": ""}, "snippet": "\t\t\ttext = util.retrieve_text(scratch_text_name_root)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:If_L37_C3", "label": "if", "type": "if", "loc": [37, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L33_C2", "vector": [4, 3, 0.8298, 0.1064, 3, 0.81, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif graceful_errors:\n\t\t\t\tim = Image.open(filename)\n\t\t\t\ttext = image_to_string(im, cleanup)\n\t\t\telse:\n\t\t\t\traise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Assign_L38_C4", "label": "im = open()", "type": "assigned_variable", "loc": [38, 38], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:If_L37_C3", "vector": [14, 4, 0.8085, 0.0213, 4, 0.01, 0.0, 940, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "im", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "\t\t\t\tim = Image.open(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Assign_L39_C4", "label": "text = image_to_string()", "type": "assigned_variable", "loc": [39, 39], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:If_L37_C3", "vector": [14, 4, 0.8298, 0.0213, 4, 0.01, 1.0, 439, 3, 2, 0, 0, 518, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "image_to_string", "annotation": ""}, "snippet": "\t\t\t\ttext = image_to_string(im, cleanup)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:If_L43_C2", "label": "if", "type": "if", "loc": [43, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L32_C1", "vector": [4, 2, 0.9255, 0.0426, 2, 0.9, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif cleanup:\n\t\t\tutil.perform_cleanup(scratch_image_name, scratch_text_name_root)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Expr_L44_C3", "label": "perform_cleanup()", "type": "expression", "loc": [44, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:If_L43_C2", "vector": [8, 3, 0.9362, 0.0213, 3, 0.05, 0.0, 759, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "perform_cleanup", "arg_names": [], "import_names": [], "rhs_call_name": "perform_cleanup", "annotation": ""}, "snippet": "\t\t\tutil.perform_cleanup(scratch_image_name, scratch_text_name_root)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1398:Return_L45_C1", "label": "return", "type": "return", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L28_C0", "vector": [13, 1, 0.9574, 0.0213, 1, 0.4, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn text"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Expr_L8_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Assign_L10_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Assign_L11_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Assign_L12_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:If_L13_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:If_L13_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Expr_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Expr_L17_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L19_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Expr_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Expr_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Assign_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:If_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:If_L24_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Expr_L25_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Return_L26_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Expr_L29_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L32_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L32_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Expr_L34_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Assign_L35_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:If_L37_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:If_L37_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:If_L37_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:Try_L32_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:If_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:If_L43_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Expr_L44_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1398:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1398:Return_L45_C1"}] |
import cv2
import cv
import sys
import cpoo_tools as tools
import pylab
import numpy as np
img = cv.LoadImage(sys.argv[1])
#img = cv.LoadImage("meat/rgb.png")
# eig_image = cv.CreateMat(img.rows, img.cols, cv2.CV_32FC1)
# temp_image = cv.CreateMat(img.rows, img.cols, cv2.CV_32FC1)
# for (x,y) in cv.GoodFeaturesToTrack(img, eig_image, temp_image, 100, 0.04, 1.0, useHarris = True):
# print "good feature at", x,y
#dst = cv.CreateImage(cv.GetSize(img), cv.IPL_DEPTH_16S, img.channels)
#laplace = cv.Laplace(img, dst)
#cv.ShowImage('sth', laplace)
#cv.WaitKey()
print "height: "+str(img.height)
print "width: "+str(img.width)
print type(img)
red = cv.CreateImage(cv.GetSize(img), img.depth, 1)
blue = cv.CreateImage(cv.GetSize(img), img.depth, 1)
green = cv.CreateImage(cv.GetSize(img), img.depth, 1)
print type(red)
print "reddepth: "+str(red.depth)
#print img.rows
#print img.cols
#print img[100,100][1]
#red = img
for y in range(0,img.height):
for x in range(0,img.width):
#rED = pImg[i*img->widthStep + j*img->nChannels + 2];
#print str(x)+", "+str(y)+"value: "+str(img[y,x][2])
# blue[y,x] = img[y,x][0];
# green[y,x] = img[y,x][1];
red[y,x] = img[y,x][2];
scores = list()
THRESH = 10
OPTIMAL_HEIGHT = img.height / 20
redunblurred = red
red = cv2.GaussianBlur(tools.cv2array(red),(5,5),OPTIMAL_HEIGHT/2)
red = tools.array2cv(red)
print "optimal height: "+str(OPTIMAL_HEIGHT)
weight_centers = dict();
#for y in range(0,img.height):
#score=0
#values=set()
#last_pos = dict();
#first_pos = dict();
#local_scores = dict();
#map(value, last_position)
#map(value, score)
#if last occurence long ago - zero the score
#score= max score for row!
#for x in range(0, img.width):
# color = red[y,x]
# if color in values:
# if y!=0 and x!= 0 and abs(red[y,x-1] - red[y,x])>THRESH:
# if x-first_pos[color]>img.width:
# #print "rejection criterion triggered"
# local_scores[color]=0
# else:
# local_scores[color]=local_scores[color]+1#red.width/(x-last_pos[color])
# if y in weight_centers.keys():
# print "this is sth for dictionary"
# weight_centers[y][0]+=x
# weight_centers[y][1]+=1
# else:
# weight_centers[y]=[x,1]
# else:
#first encounter of given color within a line
# values.add(red[y,x])
# local_scores[color] = 0
# first_pos[color]=x
# last_pos[red[y,x]]=x
#score = sum(local_scores.values())
#print "row: "+str(y)+" score: "+str(score)+" values.size="+str(len(values))
#scores.append(score)
# hmm, remove the frame results
for i in range(OPTIMAL_HEIGHT, -1, -1):
scores[i]=scores[i+1]
scores[len(scores)-1-i]=scores[len(scores)-2-i]
print scores
diffs = list()
global_min=0
global_max=0
min_sum = 0
max_sum = 0
diffs.append(0)
for i in range(1,len(scores)):
diffs.append(scores[i]-scores[i-1])
# if i>1:
# positive_sum = max(diffs[i],0)+max(diffs[i-1],0)+max(diffs[i-2],0)
# negative_sum = min(diffs[i],0)+min(diffs[i-1],0)+min(diffs[i-2],0)
# if positive_sum > max_sum:
# max_sum = positive_sum
# global_max=i
# elif negative_sum < min_sum:
# min_sum = negative_sum
# global_min=i
# print str(i)+" row: "+str(diffs[i])
#for i in range(0, len(scores)-1):
# if diffs[i] * diffs[i+1] >0:
# diffs[i]=diffs[i]+diffs[i+1]
#for i in range(0,len(diffs)):
# if diffs[i]>diffs[global_max]:
# global_max=i
# elif diffs[i]<diffs[global_min]:
# global_min=i
print "weight_centers"
avg_center=0
counter=0;
for key in weight_centers.keys():
if key> global_max and key<global_min:
counter +=1
avg_center+=weight_centers[key][0]/weight_centers[key][1]
avg_center/=counter
print "Mass center (X) for datestamp: "+str(avg_center)
print "min: "+str(global_min)+"("+str(min_sum)+"), max: "+str(global_max)+" ("+str(diffs[global_min])+")"
clipped = cv.GetSubRect(redunblurred, (avg_center, global_max, img.width-avg_center, global_min-global_max))
cv.ShowImage("clipping zone", clipped)
#cv.WaitKey()
#cv.ShowImage("green",green)
#cv.WaitKey()
#cv.ShowImage("blue",blue)
#cv.WaitKey()
#cv.ShowImage("orignal",img)
#thresh = cv2.adaptiveThreshold(np.asarray(clipped),255,1,1,11,2)
#cv.SaveImage("clipped.png", clipped)
#cv.SaveImage("thresh.png", cv.fromarray(thresh))
#cv.ShowImage("clipped", cv.fromarray(clipped))
cv.WaitKey()
| ajibawa-2023/Python-Code-Large/train/row_1399 | 48 | 153 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Import_L1_C0", "label": "cv2 import cv2", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0065, 0.0065, 0, 0.66, 0.0, 896, 0, 1, 0, 0, 896, 0, 0], "semantic": {"name": "cv2", "arg_names": [], "import_names": ["cv2"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cv2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Import_L2_C0", "label": "cv import cv", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0131, 0.0065, 0, 0.66, 0.0244, 492, 0, 1, 0, 0, 492, 0, 0], "semantic": {"name": "cv", "arg_names": [], "import_names": ["cv"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0196, 0.0065, 0, 0.66, 0.0488, 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_1399:Import_L4_C0", "label": "cpoo_tools import tools", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0261, 0.0065, 0, 0.66, 0.0732, 991, 0, 1, 0, 0, 991, 0, 0], "semantic": {"name": "cpoo_tools", "arg_names": [], "import_names": ["tools"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cpoo_tools as tools"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Import_L5_C0", "label": "pylab import pylab", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0327, 0.0065, 0, 0.66, 0.0976, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "pylab", "arg_names": [], "import_names": ["pylab"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pylab"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Import_L6_C0", "label": "numpy import np", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0392, 0.0065, 0, 0.66, 0.122, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L8_C0", "label": "img = LoadImage()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.0523, 0.0065, 0, 0.66, 0.1463, 200, 3, 1, 0, 0, 512, 10, 1], "semantic": {"name": "img", "arg_names": [], "import_names": [], "rhs_call_name": "LoadImage", "annotation": ""}, "snippet": "img = cv.LoadImage(sys.argv[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Expr_L20_C0", "label": "print()", "type": "expression", "loc": [20, 20], "level": 0, "parent": null, "vector": [8, 0, 0.1307, 0.0065, 0, 0.66, 0.1707, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"height: \"+str(img.height))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Expr_L21_C0", "label": "print()", "type": "expression", "loc": [21, 21], "level": 0, "parent": null, "vector": [8, 0, 0.1373, 0.0065, 0, 0.66, 0.1951, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"width: \"+str(img.width))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Expr_L22_C0", "label": "print()", "type": "expression", "loc": [22, 22], "level": 0, "parent": null, "vector": [8, 0, 0.1438, 0.0065, 0, 0.66, 0.2195, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(type(img))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L24_C0", "label": "red = CreateImage()", "type": "assigned_variable", "loc": [24, 24], "level": 0, "parent": null, "vector": [14, 0, 0.1569, 0.0065, 0, 0.66, 0.2439, 903, 3, 3, 0, 0, 288, 10, 2], "semantic": {"name": "red", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": "red = cv.CreateImage(cv.GetSize(img), img.depth, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L25_C0", "label": "blue = CreateImage()", "type": "assigned_variable", "loc": [25, 25], "level": 0, "parent": null, "vector": [14, 0, 0.1634, 0.0065, 0, 0.66, 0.2683, 257, 3, 3, 0, 0, 288, 10, 2], "semantic": {"name": "blue", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": "blue = cv.CreateImage(cv.GetSize(img), img.depth, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L26_C0", "label": "green = CreateImage()", "type": "assigned_variable", "loc": [26, 26], "level": 0, "parent": null, "vector": [14, 0, 0.1699, 0.0065, 0, 0.66, 0.2927, 128, 3, 3, 0, 0, 288, 10, 2], "semantic": {"name": "green", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": "green = cv.CreateImage(cv.GetSize(img), img.depth, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Expr_L30_C0", "label": "print()", "type": "expression", "loc": [30, 30], "level": 0, "parent": null, "vector": [8, 0, 0.1961, 0.0065, 0, 0.66, 0.3171, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(type(red))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Expr_L31_C0", "label": "print()", "type": "expression", "loc": [31, 31], "level": 0, "parent": null, "vector": [8, 0, 0.2026, 0.0065, 0, 0.66, 0.3415, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"reddepth: \"+str(red.depth))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:For_L38_C0", "label": "for y", "type": "for", "loc": [38, 44], "level": 0, "parent": null, "vector": [6, 0, 0.268, 0.0458, 0, 0.66, 0.3659, 304, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for y in range(0,img.height):\n for x in range(0,img.width):\n #rED = pImg[i*img->widthStep + j*img->nChannels + 2];\n #print str(x)+\", \"+str(y)+\"value: \"+str(img[y,x][2])\n# blue[y,x] = img[y,x][0];\n# green[y,x] = img[y,x][1];\n red[y,x] = img[y,x][2];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:For_L39_C2", "label": "for x", "type": "for", "loc": [39, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1399:For_L38_C0", "vector": [6, 1, 0.2712, 0.0392, 1, 0.13, 0.0, 190, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in range(0,img.width):\n #rED = pImg[i*img->widthStep + j*img->nChannels + 2];\n #print str(x)+\", \"+str(y)+\"value: \"+str(img[y,x][2])\n# blue[y,x] = img[y,x][0];\n# green[y,x] = img[y,x][1];\n red[y,x] = img[y,x][2];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L44_C6", "label": "assign", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1399:For_L39_C2", "vector": [14, 2, 0.2876, 0.0065, 2, 0.22, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " red[y,x] = img[y,x][2];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L47_C0", "label": "scores = list()", "type": "assigned_variable", "loc": [47, 47], "level": 0, "parent": null, "vector": [14, 0, 0.3072, 0.0065, 0, 0.66, 0.3902, 50, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "scores", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "scores = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L48_C0", "label": "THRESH =", "type": "assigned_variable", "loc": [48, 48], "level": 0, "parent": null, "vector": [14, 0, 0.3137, 0.0065, 0, 0.66, 0.4146, 59, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "THRESH", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "THRESH = 10"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L49_C0", "label": "OPTIMAL_HEIGHT =", "type": "assigned_variable", "loc": [49, 49], "level": 0, "parent": null, "vector": [14, 0, 0.3203, 0.0065, 0, 0.66, 0.439, 316, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "OPTIMAL_HEIGHT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "OPTIMAL_HEIGHT = img.height / 20"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L51_C0", "label": "redunblurred =", "type": "assigned_variable", "loc": [51, 51], "level": 0, "parent": null, "vector": [14, 0, 0.3333, 0.0065, 0, 0.66, 0.4634, 854, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "redunblurred", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "redunblurred = red"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L52_C0", "label": "red = GaussianBlur()", "type": "assigned_variable", "loc": [52, 52], "level": 0, "parent": null, "vector": [14, 0, 0.3399, 0.0065, 0, 0.66, 0.4878, 903, 3, 3, 0, 0, 219, 10, 2], "semantic": {"name": "red", "arg_names": [], "import_names": [], "rhs_call_name": "GaussianBlur", "annotation": ""}, "snippet": "red = cv2.GaussianBlur(tools.cv2array(red),(5,5),OPTIMAL_HEIGHT/2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L53_C0", "label": "red = array2cv()", "type": "assigned_variable", "loc": [53, 53], "level": 0, "parent": null, "vector": [14, 0, 0.3464, 0.0065, 0, 0.66, 0.5122, 903, 3, 1, 0, 0, 769, 10, 1], "semantic": {"name": "red", "arg_names": [], "import_names": [], "rhs_call_name": "array2cv", "annotation": ""}, "snippet": "red = tools.array2cv(red)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Expr_L55_C0", "label": "print()", "type": "expression", "loc": [55, 55], "level": 0, "parent": null, "vector": [8, 0, 0.3595, 0.0065, 0, 0.66, 0.5366, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"optimal height: \"+str(OPTIMAL_HEIGHT))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L56_C0", "label": "weight_centers = dict()", "type": "assigned_variable", "loc": [56, 56], "level": 0, "parent": null, "vector": [14, 0, 0.366, 0.0065, 0, 0.66, 0.561, 302, 3, 0, 0, 0, 827, 10, 1], "semantic": {"name": "weight_centers", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": "weight_centers = dict();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:For_L93_C0", "label": "for i", "type": "for", "loc": [93, 95], "level": 0, "parent": null, "vector": [6, 0, 0.6144, 0.0196, 0, 0.66, 0.5854, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(OPTIMAL_HEIGHT, -1, -1):\n scores[i]=scores[i+1]\n scores[len(scores)-1-i]=scores[len(scores)-2-i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L94_C2", "label": "assign", "type": "assigned_variable", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1399:For_L93_C0", "vector": [14, 1, 0.6144, 0.0065, 1, 0.43, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scores[i]=scores[i+1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L95_C2", "label": "assign", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1399:For_L93_C0", "vector": [14, 1, 0.6209, 0.0065, 1, 0.43, 1.0, 0, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scores[len(scores)-1-i]=scores[len(scores)-2-i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Expr_L97_C0", "label": "print()", "type": "expression", "loc": [97, 97], "level": 0, "parent": null, "vector": [8, 0, 0.634, 0.0065, 0, 0.66, 0.6098, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(scores)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L99_C0", "label": "diffs = list()", "type": "assigned_variable", "loc": [99, 99], "level": 0, "parent": null, "vector": [14, 0, 0.6471, 0.0065, 0, 0.66, 0.6341, 809, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "diffs", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "diffs = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L100_C0", "label": "global_min =", "type": "assigned_variable", "loc": [100, 100], "level": 0, "parent": null, "vector": [14, 0, 0.6536, 0.0065, 0, 0.66, 0.6585, 219, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "global_min", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "global_min=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L101_C0", "label": "global_max =", "type": "assigned_variable", "loc": [101, 101], "level": 0, "parent": null, "vector": [14, 0, 0.6601, 0.0065, 0, 0.66, 0.6829, 35, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "global_max", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "global_max=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L102_C0", "label": "min_sum =", "type": "assigned_variable", "loc": [102, 102], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0065, 0, 0.66, 0.7073, 827, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "min_sum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "min_sum = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L103_C0", "label": "max_sum =", "type": "assigned_variable", "loc": [103, 103], "level": 0, "parent": null, "vector": [14, 0, 0.6732, 0.0065, 0, 0.66, 0.7317, 906, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "max_sum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "max_sum = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Expr_L104_C0", "label": "append()", "type": "expression", "loc": [104, 104], "level": 0, "parent": null, "vector": [8, 0, 0.6797, 0.0065, 0, 0.66, 0.7561, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "diffs.append(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:For_L105_C0", "label": "for i", "type": "for", "loc": [105, 106], "level": 0, "parent": null, "vector": [6, 0, 0.6895, 0.0131, 0, 0.66, 0.7805, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(1,len(scores)):\n diffs.append(scores[i]-scores[i-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Expr_L106_C2", "label": "append()", "type": "expression", "loc": [106, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1399:For_L105_C0", "vector": [8, 1, 0.6928, 0.0065, 1, 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": " diffs.append(scores[i]-scores[i-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Expr_L128_C0", "label": "print()", "type": "expression", "loc": [128, 128], "level": 0, "parent": null, "vector": [8, 0, 0.8366, 0.0065, 0, 0.66, 0.8049, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"weight_centers\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L129_C0", "label": "avg_center =", "type": "assigned_variable", "loc": [129, 129], "level": 0, "parent": null, "vector": [14, 0, 0.8431, 0.0065, 0, 0.66, 0.8293, 821, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "avg_center", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "avg_center=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L130_C0", "label": "counter =", "type": "assigned_variable", "loc": [130, 130], "level": 0, "parent": null, "vector": [14, 0, 0.8497, 0.0065, 0, 0.66, 0.8537, 7, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "counter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "counter=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:For_L131_C0", "label": "for key", "type": "for", "loc": [131, 134], "level": 0, "parent": null, "vector": [6, 0, 0.866, 0.0261, 0, 0.66, 0.878, 230, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for key in weight_centers.keys():\n if key> global_max and key<global_min:\n counter +=1\n avg_center+=weight_centers[key][0]/weight_centers[key][1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:If_L132_C2", "label": "if", "type": "if", "loc": [132, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1399:For_L131_C0", "vector": [4, 1, 0.8693, 0.0196, 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 key> global_max and key<global_min:\n counter +=1\n avg_center+=weight_centers[key][0]/weight_centers[key][1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Expr_L137_C0", "label": "print()", "type": "expression", "loc": [137, 137], "level": 0, "parent": null, "vector": [8, 0, 0.8954, 0.0065, 0, 0.66, 0.9268, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"Mass center (X) for datestamp: \"+str(avg_center))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Expr_L139_C0", "label": "print()", "type": "expression", "loc": [139, 139], "level": 0, "parent": null, "vector": [8, 0, 0.9085, 0.0065, 0, 0.66, 0.9512, 535, 3, 1, 0, 0, 0, 0, 5], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"min: \"+str(global_min)+\"(\"+str(min_sum)+\"), max: \"+str(global_max)+\" (\"+str(diffs[global_min])+\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L141_C0", "label": "clipped = GetSubRect()", "type": "assigned_variable", "loc": [141, 141], "level": 0, "parent": null, "vector": [14, 0, 0.9216, 0.0065, 0, 0.66, 0.9756, 26, 3, 2, 0, 0, 469, 10, 1], "semantic": {"name": "clipped", "arg_names": [], "import_names": [], "rhs_call_name": "GetSubRect", "annotation": ""}, "snippet": "clipped = cv.GetSubRect(redunblurred, (avg_center, global_max, img.width-avg_center, global_min-global_max))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Expr_L142_C0", "label": "ShowImage()", "type": "expression", "loc": [142, 142], "level": 0, "parent": null, "vector": [8, 0, 0.9281, 0.0065, 0, 0.66, 1.0, 896, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "ShowImage", "arg_names": [], "import_names": [], "rhs_call_name": "ShowImage", "annotation": ""}, "snippet": "cv.ShowImage(\"clipping zone\", clipped) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1399:Expr_L153_C0", "label": "WaitKey()", "type": "expression", "loc": [153, 153], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0065, 0, 0.66, 1.0244, 885, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "WaitKey", "arg_names": [], "import_names": [], "rhs_call_name": "WaitKey", "annotation": ""}, "snippet": "cv.WaitKey()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1399:For_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1399:For_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1399:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L44_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1399:For_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L94_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1399:For_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1399:Assign_L95_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1399:For_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1399:Expr_L106_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1399:For_L131_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1399:If_L132_C2"}] |
import cv
import cv2
import numpy as np
import collections
def extract( image, region ):
histogram = dict()
imgcp = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )
cv.Copy( image, imgcp )
for pixel in region:
color = imgcp[pixel[1], pixel[0]]
if color not in histogram.keys():
histogram[color] = 1
else:
histogram[color] += 1
prevailing = histogram.keys()[0]
for color in histogram.keys():
if histogram[color] > histogram[prevailing]:
prevailing = color
start = region_start( region )
height = region_height( region )
width = region_width( region )
# dirty
imgcp = cropImage( imgcp, start[0] - 5, start[1] - 2, start[0] + width + 5, start[1] + height + 2 )
avg_color = np.average( histogram.keys(), 0, histogram.values() )
cv.Threshold( imgcp, imgcp, int( avg_color * 0.75 ), 255, 0 )
return imgcp
def manually_convolve( img1, img2 ):
for x in range ( 0, img1.width ):
for y in range ( 0, img1.height ):
img1[y, x] *= img2[y, x] / 255.0
return img1
# so far just red - hard-coded
def split_channels( img ):
if img.nChannels == 1:
return img
new_img = cv.CreateImage( cv.GetSize( img ), img.depth, 1 )
for y in range( 0, img.height ):
for x in range( 0, img.width ):
new_img[y, x] = img[y, x][2];
return new_img
def thicken_contour( image, edge_col=255, median_radius=1 ):
img = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )
kernel = cv.CreateMat( 2 * median_radius + 1, 2 * median_radius + 1, cv.CV_8S )
cv.Set( kernel[:, :], 1 )
cv.Filter2D( image, img, kernel )
return img
# sums up values of given piece of image - checks for borders
def safe_subsum( mat, startx, starty, stopx, stopy ):
list = np.asarray( mat[max( starty, 0 ):min( stopy, mat.height - 1 ), max( startx, 0 ):min( stopx, mat.width - 1 )] ).reshape( -1 ).tolist()
return sum( list )
# hard-coded: margin
def get_neighbors( img, point ):
neighbors = set()
for dx in range( -1, 2 ):
for dy in range( -1, 2 ):
x = point[0] + dx
y = point[1] + dy
if x >= 0 and x < img.width and y >= 0 and y < img.height: # and ( dx == 0 or dy == 0 ):
neighbors.add( ( x, y ) )
return neighbors
# region consists of one element only
def create_region( img, point, cutoff=10 ):
region = set()
region.add( point )
neighbors = get_neighbors( img, point )
while len( neighbors ) > 0:
far_neighbors = set()
for neighbor in neighbors:
if neighbor not in region and merge_criterion( img, point, neighbor, cutoff ):
region.add( neighbor )
for far_neighbor in get_neighbors( img, neighbor ):
if far_neighbor not in region:
far_neighbors.add( far_neighbor )
neighbors = far_neighbors
return region
def merge_criterion( img, pt_one, pt_two, cutoff=10 ):
# print "pt_one: " + str( pt_one ) + ", pt_two: " + str( pt_two )+", H:"+str(img.height)+", W:"+str(img.width)
difference = abs( img[pt_one[1], pt_one[0]] - img[pt_two[1], pt_two[0]] )
return difference < cutoff
def region_start( region ):
minx = 100000
miny = 100000
for point in region:
minx = min( point[0], minx )
miny = min( point[1], miny )
return ( minx, miny )
def region_leanness( region ):
return ( region_height( region ) + 0.0 ) / region_width( region )
def region_height( region ):
return region_span( region, 1 )
def region_width( region ):
return region_span( region, 0 )
def region_center( region ):
sumx = sumy = 0
for point in region:
sumy += point[1]
sumx += point[0]
return ( 1.0 * sumx / len( region ), 1.0 * sumy / len( region ) )
def region_span( region, axis_index ):
minh = 100000
maxh = -100000
for point in region:
minh = min( point[axis_index], minh )
maxh = max( point[axis_index], maxh )
return maxh - minh + 1
# returns a cropped image object
def cropImage( image, xstart, ystart, xend, yend ):
width = min( xend, image.width - 1 ) - xstart
height = min( yend, image.height - 1 ) - ystart
cv.CreateImage
cropped = cv.CreateImage( ( width, height ), image.depth, image.nChannels )
src_region = cv.GetSubRect( image, ( max( xstart, 0 ), max( ystart, 0 ), width, height ) )
cv.Copy( src_region, cropped )
return cropped
# under construction
def grow_regions( image, seed_color=0, eaten_color=255 ):
print "growing regions"
selected_regions = list()
for y in range( 0, image.height ):
for x in range( 0, image.width ):
if image[y, x] == seed_color:
region = create_region( image, ( x, y ), 25 )
if len( region ) > 1:
selected_regions.append( region )
for point in region:
image[point[1], point[0]] = eaten_color;
paint_regions( selected_regions, image )
return selected_regions
def kill_the_losers( org_img, regions ):
sf = 4
truth = True
while truth:
truth = False
for i in range( 0, len( regions ) ):
# ratio_criterion = len( regions[i] ) * sf / region_height( regions[i] ) < region_width( regions[i] ) or len( regions[i] ) * sf / region_width( regions[i] ) < region_height( regions[i] )
length_criterion = region_width( regions[i] ) < 1.5 * region_height( regions[i] )
height_criterion = region_height( regions[i] ) < org_img.height * 0.02
size_criterion = len( regions[i] ) < 4 * optimal_radius( org_img )
if size_criterion or length_criterion or height_criterion:
truth = True
regions.pop( i )
break;
paint_regions( regions, org_img )
return regions
def cluster_regions ( org_img, regions ):
starts = list()
heights = list()
widths = list()
centers = list()
# init data for merging
for region in regions:
start = region_start( region )
starts.append( start )
heights.append( region_height( region ) )
widths.append( region_width( region ) )
centers.append( region_center( region ) )
#
truth = True
iterations_counter = 0
while truth and len( regions ) > 1:
iterations_counter += 1
if iterations_counter % 25 == 0:
print "clustering regions..."
for i in range( 0, len( regions ) ):
truth = False
for j in range( i + 1, len( regions ) ):
joint_mass = len( regions[i] ) + len( regions[j] )
gravity_criterion = ( ( centers[i][0] - centers[j][0] ) ** 2 + ( centers[i][1] - centers[j][1] ) ** 2 ) < 50 * ( joint_mass )
horizontal_criterion = ( centers[i][0] - centers[j][0] ) ** 2 < 40 * joint_mass
vertical_criterion = ( centers[i][1] - centers[j][1] ) ** 2 < joint_mass
width_criterion = widths[i] + widths[j] + abs( centers[i][0] - centers[j][0] ) < 2 * len( regions[i] ) + len( regions[j] )
if ( gravity_criterion and width_criterion and vertical_criterion and horizontal_criterion ):
truth = True
regions[i] = regions[i].union( regions[j] )
heights[i] = region_height( regions[i] )
widths[i] = region_width( regions[i] )
starts[i] = region_start( regions[i] )
centers[i] = region_center( regions[i] )
regions.pop( j )
heights.pop( j )
widths.pop( j )
centers.pop( j )
starts.pop( j )
break;
if truth:
break
paint_regions( regions, org_img )
print "all suitable regions merged"
return regions
def paint_regions( regions, image, caption="cpoo" ):
res = cv.CreateImage( cv.GetSize( image ), image.depth, 3 )
# assumes 3-channeled original
for x in range ( 0, res.width ):
for y in range( 0, res.height ):
res[y, x] = ( 0, 0, 0 )
colors = [( 0, 0, 255 ), ( 0, 255, 0 ), ( 255, 0, 0 ), ( 255, 0, 255 ), ( 255, 255, 0 ), ( 0, 0, 255 ), ( 255, 255, 255 )]
color_counter = 0;
for region in regions:
color_counter = ( ( color_counter + 1 ) % len( colors ) )
for point in region:
res[point[1], point[0]] = colors[color_counter]
show_wait( res, caption )
def compare_pixels( p1, p2, tolerance ):
diff = 0
if isinstance ( p1, collections.Iterable ):
temp_tolerance = 0
for dim in range( 0, len( p1 ) ):
diff += abs( p1[dim] - p2[dim] )
temp_tolerance += tolerance
tolerance = temp_tolerance
else:
diff = abs( p1 - p2 );
return diff < tolerance
# returns a window median_radius size for processing
def optimal_radius( picture ):
return picture.height / 30
# returns a global map of text-related energy for the picture
def text_energy_map( image ):
image = split_channels( image )
radius = optimal_radius( image )
laplac = laplacian( image )
laplac = gaussian_blur_icl( laplac, ( radius, radius ), radius )
# init compass results
result_0 = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )
result_45 = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )
result_90 = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )
result_135 = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )
# compass one: operator & result
ker_0 = cv.CreateMat( 3, 3, cv.CV_8S )
cv.Set( ker_0, -1 )
cv.Set( ker_0[1, :], 2 )
cv.Filter2D( image, result_0, ker_0 )
# compass two
ker_45 = cv.CreateMat( 3, 3, cv.CV_8S )
cv.Set( ker_45, -1 )
ker_45[2, 2] = ker_45[1, 1] = ker_45[0, 0] = 2;
cv.Filter2D( image, result_45, ker_45 )
# compass three
ker_90 = cv.CreateMat( 3, 3, cv.CV_8S )
cv.Set( ker_90, -1 )
cv.Set( ker_90[:, 1], 2 )
cv.Filter2D( image, result_90, ker_90 )
# compass four
ker_135 = cv.CreateMat( 3, 3, cv.CV_8S )
cv.Set( ker_135, -1 )
ker_135[2, 0] = ker_135[1, 1] = ker_135[0, 2] = 2;
cv.Filter2D( image, result_135, ker_135 )
# prepare result image and temporary helper
density = cv.CreateImage( cv.GetSize( image ), image.depth, 1 )
temp = cv.CreateImage( cv.GetSize( image ), image.depth, 1 )
cv.AddWeighted( result_0, 0.5, result_90, 0.5, 0, density )
cv.AddWeighted( result_45, 0.5, result_135, 0.5, 0, temp )
cv.AddWeighted( temp, 0.5, density, 0.5, 0, density )
# display obtained (weighted sum) of constituent images
# blur the density to highlight areas
density = gaussian_blur_icl( density, ( 3, 3 ), radius )
# displays again
# show_wait( density, "cpoo" )
# create a map of pixel weights - proportional to a total of orientations within window
orients = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )
# threshold each picture - simulates summing orientations upon subsequent addition of images
cv.Threshold( result_0, result_0, 128, 255, 0 )
cv.Threshold( result_45, result_45, 128, 255, 0 )
cv.Threshold( result_90, result_90, 128, 255, 0 )
cv.Threshold( result_135, result_135, 128, 255, 0 )
# just summing - don't like that part really
cv.AddWeighted( result_0, 0.5, result_45, 0.5, 0, result_0 )
cv.AddWeighted( result_90, 0.5, result_135, 0.5, 0, result_90 )
cv.AddWeighted( result_90, 0.5, result_0, 0.5, 0, orients )
# show( orients, "orients raw" )
# equalizing and slightly blurring. not nice really again
cv.EqualizeHist( orients, orients )
# orients = gaussian_blur_icl( orients, ( 3, 3 ), radius )
# show_wait( orients, "cpoo" )
# manually convolve density and orients
for x in range( 0, density.width ):
for y in range( 0, density.height ):
density[y, x] *= orients[y, x] * laplac[y, x] / ( 255.0 * 255.0 )
cv.EqualizeHist( density, density )
return density
def gaussian_blur_icl( image, ksize, sigmaX ):
a = ksize[0]
b = ksize[1]
if a % 2 == 0:
a += 1;
if b % 2 == 0:
b += 1
return array2cv( cv2.GaussianBlur( cv2array( image ), ( a, b ), sigmaX ) )
def average_pixels( image, dims ):
kernel = cv.CreateMat( dims[0], dims[1], cv.CV_32F )
cv.Set( kernel, 1.0 / ( dims[0] * dims[1] ) )
cv.Filter2D( image, image, kernel )
return image
def laplacian( image ):
dst = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )
kernel = cv.CreateMat( 3, 3, cv.CV_32F )
cv.Set( kernel, 1 )
kernel[0, 1] = kernel[1, 0] = kernel[2, 1] = kernel[1, 2] = 2
kernel[1, 1] = -12
cv.Filter2D( image, dst, kernel )
return dst
# from openCV python wiki
def cv2array( im ):
depth2dtype = {
cv.IPL_DEPTH_8U: 'uint8',
cv.IPL_DEPTH_8S: 'int8',
cv.IPL_DEPTH_16U: 'uint16',
cv.IPL_DEPTH_16S: 'int16',
cv.IPL_DEPTH_32S: 'int32',
cv.IPL_DEPTH_32F: 'float32',
cv.IPL_DEPTH_64F: 'float64',
}
arrdtype = im.depth
a = np.fromstring(
im.tostring(),
dtype=depth2dtype[im.depth],
count=im.width * im.height * im.nChannels )
a.shape = ( im.height, im.width, im.nChannels )
return a
# from openCV python wiki
def array2cv( a ):
dtype2depth = {
'uint8': cv.IPL_DEPTH_8U,
'int8': cv.IPL_DEPTH_8S,
'uint16': cv.IPL_DEPTH_16U,
'int16': cv.IPL_DEPTH_16S,
'int32': cv.IPL_DEPTH_32S,
'float32': cv.IPL_DEPTH_32F,
'float64': cv.IPL_DEPTH_64F,
}
try:
nChannels = a.shape[2]
except:
nChannels = 1
cv_im = cv.CreateImageHeader( ( a.shape[1], a.shape[0] ),
dtype2depth[str( a.dtype )],
nChannels )
cv.SetData( cv_im, a.tostring(),
a.dtype.itemsize * nChannels * a.shape[1] )
return cv_im
def sum_orients( img, x, y, median_radius, threshold=255 ):
sum = 0
for curx in range( max( x - median_radius, 0 ), min( x + median_radius, img.width ) ):
for cury in range( max( y - median_radius, 0 ), min( y + median_radius, img.height ) ):
if( img[cury, curx] >= threshold ):
sum += 1
return sum
# shortcut for openCV display functions
def show( picture, desc="no_desc" ):
return
cv.ShowImage( desc, picture )
cv.WaitKey()
def show_wait( picture, desc="no_desc" ):
cv.ShowImage( desc, picture )
cv.WaitKey()
def sum_array( array ):
return sum( np.asarray( array ).reshape( -1 ).tolist() )
def find_density_maximum( image ):
i = [0, 0, image.width, image.height]
max_copy = i
max_density = 0
while True:
# print "current density: " + str( max_density )
for ind in range( 0, 4 ):
copy = list( i )
if ind > 1:
copy[ind] -= 1
else:
copy[ind] += 1
density = sum_array( image[copy[1] : copy[3], copy[0] : copy[2]] ) ** 2 * 1.0 / ( ( copy[3] - copy[1] ) * ( copy[2] - copy[0] ) ) ** 2
# print "candidate_density: " + str( density )
if density > max_density:
max_density = density
max_copy = copy
if i == max_copy:
break
else:
i = max_copy
return max_copy
| ajibawa-2023/Python-Code-Large/train/row_1400 | 298 | 449 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Import_L1_C0", "label": "cv import cv", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0022, 0.0022, 0, 0.66, 0.0, 492, 0, 1, 0, 0, 492, 0, 0], "semantic": {"name": "cv", "arg_names": [], "import_names": ["cv"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Import_L2_C0", "label": "cv2 import cv2", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0045, 0.0022, 0, 0.66, 0.0286, 896, 0, 1, 0, 0, 896, 0, 0], "semantic": {"name": "cv2", "arg_names": [], "import_names": ["cv2"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cv2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Import_L3_C0", "label": "numpy import np", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0067, 0.0022, 0, 0.66, 0.0571, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Import_L4_C0", "label": "collections import collections", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0089, 0.0022, 0, 0.66, 0.0857, 193, 0, 1, 0, 0, 193, 0, 0], "semantic": {"name": "collections", "arg_names": [], "import_names": ["collections"], "rhs_call_name": "", "annotation": ""}, "snippet": "import collections"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "label": "extract", "type": "function", "loc": [6, 34], "level": 0, "parent": null, "vector": [2, 0, 0.0445, 0.0646, 0, 0.66, 0.1143, 450, 0, 2, 1, 0, 0, 0, 16], "semantic": {"name": "extract", "arg_names": ["image", "region"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def extract( image, region ):\n histogram = dict()\n imgcp = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )\n cv.Copy( image, imgcp )\n for pixel in region:\n color = imgcp[pixel[1], pixel[0]]\n if color not in histogram.keys():\n histogram[color] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L7_C4", "label": "histogram = dict()", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "vector": [14, 1, 0.0156, 0.0022, 1, 0.34, 0.0, 428, 3, 0, 0, 0, 827, 10, 1], "semantic": {"name": "histogram", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " histogram = dict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L8_C4", "label": "imgcp = CreateImage()", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "vector": [14, 1, 0.0178, 0.0022, 1, 0.34, 0.0833, 94, 3, 3, 0, 0, 288, 10, 2], "semantic": {"name": "imgcp", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " imgcp = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L9_C4", "label": "Copy()", "type": "expression", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "vector": [8, 1, 0.02, 0.0022, 1, 0.34, 0.1667, 295, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Copy", "arg_names": [], "import_names": [], "rhs_call_name": "Copy", "annotation": ""}, "snippet": " cv.Copy( image, imgcp )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L10_C4", "label": "for pixel", "type": "for", "loc": [10, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "vector": [6, 1, 0.0278, 0.0134, 1, 0.34, 0.25, 202, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pixel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for pixel in region:\n color = imgcp[pixel[1], pixel[0]]\n if color not in histogram.keys():\n histogram[color] = 1\n else:\n histogram[color] += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L11_C8", "label": "color =", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L10_C4", "vector": [14, 2, 0.0245, 0.0022, 2, 0.75, 0.0, 776, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "color", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " color = imgcp[pixel[1], pixel[0]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L12_C8", "label": "if", "type": "if", "loc": [12, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L10_C4", "vector": [4, 2, 0.0301, 0.0089, 2, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if color not in histogram.keys():\n histogram[color] = 1\n else:\n histogram[color] += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L13_C12", "label": "assign", "type": "assigned_variable", "loc": [13, 13], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L12_C8", "vector": [14, 3, 0.029, 0.0022, 3, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " histogram[color] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L18_C4", "label": "prevailing =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "vector": [14, 1, 0.0401, 0.0022, 1, 0.34, 0.3333, 820, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "prevailing", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prevailing = histogram.keys()[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L19_C4", "label": "for color", "type": "for", "loc": [19, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "vector": [6, 1, 0.0445, 0.0067, 1, 0.34, 0.4167, 776, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "color", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for color in histogram.keys():\n if histogram[color] > histogram[prevailing]:\n prevailing = color"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L20_C8", "label": "if", "type": "if", "loc": [20, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L19_C4", "vector": [4, 2, 0.0457, 0.0045, 2, 0.19, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if histogram[color] > histogram[prevailing]:\n prevailing = color"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L21_C12", "label": "prevailing =", "type": "assigned_variable", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L20_C8", "vector": [14, 3, 0.0468, 0.0022, 3, 0.76, 0.0, 820, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prevailing", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prevailing = color"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L23_C4", "label": "start = region_start()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "vector": [14, 1, 0.0512, 0.0022, 1, 0.34, 0.5, 511, 3, 1, 0, 0, 475, 10, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "region_start", "annotation": ""}, "snippet": " start = region_start( region )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L24_C4", "label": "height = region_height()", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "vector": [14, 1, 0.0535, 0.0022, 1, 0.34, 0.5833, 751, 3, 1, 0, 0, 602, 10, 1], "semantic": {"name": "height", "arg_names": [], "import_names": [], "rhs_call_name": "region_height", "annotation": ""}, "snippet": " height = region_height( region )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L25_C4", "label": "width = region_width()", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "vector": [14, 1, 0.0557, 0.0022, 1, 0.34, 0.6667, 989, 3, 1, 0, 0, 112, 10, 1], "semantic": {"name": "width", "arg_names": [], "import_names": [], "rhs_call_name": "region_width", "annotation": ""}, "snippet": " width = region_width( region )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L28_C4", "label": "imgcp = cropImage()", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "vector": [14, 1, 0.0624, 0.0022, 1, 0.34, 0.75, 94, 3, 5, 0, 0, 160, 10, 1], "semantic": {"name": "imgcp", "arg_names": [], "import_names": [], "rhs_call_name": "cropImage", "annotation": ""}, "snippet": " imgcp = cropImage( imgcp, start[0] - 5, start[1] - 2, start[0] + width + 5, start[1] + height + 2 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L30_C4", "label": "avg_color = average()", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "vector": [14, 1, 0.0668, 0.0022, 1, 0.34, 0.8333, 409, 3, 3, 0, 0, 273, 10, 3], "semantic": {"name": "avg_color", "arg_names": [], "import_names": [], "rhs_call_name": "average", "annotation": ""}, "snippet": " avg_color = np.average( histogram.keys(), 0, histogram.values() )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L31_C4", "label": "Threshold()", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "vector": [8, 1, 0.069, 0.0022, 1, 0.34, 0.9167, 302, 3, 5, 0, 0, 0, 0, 2], "semantic": {"name": "Threshold", "arg_names": [], "import_names": [], "rhs_call_name": "Threshold", "annotation": ""}, "snippet": " cv.Threshold( imgcp, imgcp, int( avg_color * 0.75 ), 255, 0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L34_C4", "label": "return", "type": "return", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "vector": [13, 1, 0.0757, 0.0022, 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 imgcp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L38_C0", "label": "manually_convolve", "type": "function", "loc": [38, 42], "level": 0, "parent": null, "vector": [2, 0, 0.0891, 0.0111, 0, 0.66, 0.1429, 947, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "manually_convolve", "arg_names": ["img1", "img2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def manually_convolve( img1, img2 ):\n for x in range ( 0, img1.width ):\n for y in range ( 0, img1.height ):\n img1[y, x] *= img2[y, x] / 255.0\n return img1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L39_C4", "label": "for x", "type": "for", "loc": [39, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L38_C0", "vector": [6, 1, 0.0891, 0.0067, 1, 0.98, 0.0, 190, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in range ( 0, img1.width ):\n for y in range ( 0, img1.height ):\n img1[y, x] *= img2[y, x] / 255.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L40_C8", "label": "for y", "type": "for", "loc": [40, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L39_C4", "vector": [6, 2, 0.0902, 0.0045, 2, 0.42, 0.0, 304, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for y in range ( 0, img1.height ):\n img1[y, x] *= img2[y, x] / 255.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L42_C4", "label": "return", "type": "return", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L38_C0", "vector": [13, 1, 0.0935, 0.0022, 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 img1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L45_C0", "label": "split_channels", "type": "function", "loc": [45, 53], "level": 0, "parent": null, "vector": [2, 0, 0.1091, 0.02, 0, 0.66, 0.1714, 571, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "split_channels", "arg_names": ["img"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def split_channels( img ):\n if img.nChannels == 1:\n return img\n \n new_img = cv.CreateImage( cv.GetSize( img ), img.depth, 1 )\n for y in range( 0, img.height ):\n for x in range( 0, img.width ):\n new_img[y, x] = img[y, x][2];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L46_C4", "label": "if", "type": "if", "loc": [46, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L45_C0", "vector": [4, 1, 0.1036, 0.0045, 1, 0.18, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if img.nChannels == 1:\n return img"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L47_C8", "label": "return", "type": "return", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L46_C4", "vector": [13, 2, 0.1047, 0.0022, 2, 0.83, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return img"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L49_C4", "label": "new_img = CreateImage()", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L45_C0", "vector": [14, 1, 0.1091, 0.0022, 1, 0.18, 0.3333, 637, 3, 3, 0, 0, 288, 10, 2], "semantic": {"name": "new_img", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " new_img = cv.CreateImage( cv.GetSize( img ), img.depth, 1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L50_C4", "label": "for y", "type": "for", "loc": [50, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L45_C0", "vector": [6, 1, 0.1136, 0.0067, 1, 0.18, 0.6667, 304, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for y in range( 0, img.height ):\n for x in range( 0, img.width ):\n new_img[y, x] = img[y, x][2];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L51_C8", "label": "for x", "type": "for", "loc": [51, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L50_C4", "vector": [6, 2, 0.1147, 0.0045, 2, 0.18, 0.0, 190, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in range( 0, img.width ):\n new_img[y, x] = img[y, x][2];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L52_C12", "label": "assign", "type": "assigned_variable", "loc": [52, 52], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L51_C8", "vector": [14, 3, 0.1158, 0.0022, 3, 0.09, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_img[y, x] = img[y, x][2];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L53_C4", "label": "return", "type": "return", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L45_C0", "vector": [13, 1, 0.118, 0.0022, 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 new_img"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L55_C0", "label": "thicken_contour", "type": "function", "loc": [55, 60], "level": 0, "parent": null, "vector": [2, 0, 0.1281, 0.0134, 0, 0.66, 0.2, 629, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "thicken_contour", "arg_names": ["image", "edge_col", "median_radius"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def thicken_contour( image, edge_col=255, median_radius=1 ):\n img = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )\n kernel = cv.CreateMat( 2 * median_radius + 1, 2 * median_radius + 1, cv.CV_8S )\n cv.Set( kernel[:, :], 1 )\n cv.Filter2D( image, img, kernel )\n return img"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L56_C4", "label": "img = CreateImage()", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L55_C0", "vector": [14, 1, 0.1247, 0.0022, 1, 0.53, 0.0, 200, 3, 3, 0, 0, 288, 10, 2], "semantic": {"name": "img", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " img = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L57_C4", "label": "kernel = CreateMat()", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L55_C0", "vector": [14, 1, 0.1269, 0.0022, 1, 0.53, 0.25, 688, 3, 3, 0, 0, 892, 10, 1], "semantic": {"name": "kernel", "arg_names": [], "import_names": [], "rhs_call_name": "CreateMat", "annotation": ""}, "snippet": " kernel = cv.CreateMat( 2 * median_radius + 1, 2 * median_radius + 1, cv.CV_8S )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L58_C4", "label": "Set()", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L55_C0", "vector": [8, 1, 0.1292, 0.0022, 1, 0.53, 0.5, 438, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Set", "arg_names": [], "import_names": [], "rhs_call_name": "Set", "annotation": ""}, "snippet": " cv.Set( kernel[:, :], 1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L59_C4", "label": "Filter2D()", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L55_C0", "vector": [8, 1, 0.1314, 0.0022, 1, 0.53, 0.75, 542, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "Filter2D", "arg_names": [], "import_names": [], "rhs_call_name": "Filter2D", "annotation": ""}, "snippet": " cv.Filter2D( image, img, kernel )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L60_C4", "label": "return", "type": "return", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L55_C0", "vector": [13, 1, 0.1336, 0.0022, 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 img"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L63_C0", "label": "safe_subsum", "type": "function", "loc": [63, 65], "level": 0, "parent": null, "vector": [2, 0, 0.1425, 0.0067, 0, 0.66, 0.2286, 297, 0, 5, 1, 0, 0, 0, 8], "semantic": {"name": "safe_subsum", "arg_names": ["mat", "startx", "starty", "stopx", "stopy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def safe_subsum( mat, startx, starty, stopx, stopy ):\n list = np.asarray( mat[max( starty, 0 ):min( stopy, mat.height - 1 ), max( startx, 0 ):min( stopx, mat.width - 1 )] ).reshape( -1 ).tolist()\n return sum( list )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L64_C4", "label": "list = tolist()", "type": "assigned_variable", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L63_C0", "vector": [14, 1, 0.1425, 0.0022, 1, 0.62, 0.0, 430, 3, 0, 0, 0, 185, 10, 7], "semantic": {"name": "list", "arg_names": [], "import_names": [], "rhs_call_name": "tolist", "annotation": ""}, "snippet": " list = np.asarray( mat[max( starty, 0 ):min( stopy, mat.height - 1 ), max( startx, 0 ):min( stopx, mat.width - 1 )] ).reshape( -1 ).tolist()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L65_C4", "label": "return", "type": "return", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L63_C0", "vector": [13, 1, 0.1448, 0.0022, 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 sum( list )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L69_C0", "label": "get_neighbors", "type": "function", "loc": [69, 77], "level": 0, "parent": null, "vector": [2, 0, 0.1626, 0.02, 0, 0.66, 0.2571, 341, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "get_neighbors", "arg_names": ["img", "point"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_neighbors( img, point ):\n neighbors = set()\n for dx in range( -1, 2 ):\n for dy in range( -1, 2 ):\n x = point[0] + dx\n y = point[1] + dy\n if x >= 0 and x < img.width and y >= 0 and y < img.height: # and ( dx == 0 or dy == 0 ):\n neighbors.add( ( x, y ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L70_C4", "label": "neighbors = set()", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L69_C0", "vector": [14, 1, 0.1559, 0.0022, 1, 0.64, 0.0, 227, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "neighbors", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " neighbors = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L71_C4", "label": "for dx", "type": "for", "loc": [71, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L69_C0", "vector": [6, 1, 0.1637, 0.0134, 1, 0.64, 0.5, 870, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "dx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for dx in range( -1, 2 ):\n for dy in range( -1, 2 ):\n x = point[0] + dx\n y = point[1] + dy\n if x >= 0 and x < img.width and y >= 0 and y < img.height: # and ( dx == 0 or dy == 0 ):\n neighbors.add( ( x, y ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L72_C8", "label": "for dy", "type": "for", "loc": [72, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L71_C4", "vector": [6, 2, 0.1648, 0.0111, 2, 0.68, 0.0, 477, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "dy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for dy in range( -1, 2 ):\n x = point[0] + dx\n y = point[1] + dy\n if x >= 0 and x < img.width and y >= 0 and y < img.height: # and ( dx == 0 or dy == 0 ):\n neighbors.add( ( x, y ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L73_C12", "label": "x =", "type": "assigned_variable", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L72_C8", "vector": [14, 3, 0.1626, 0.0022, 3, 0.44, 0.0, 190, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x = point[0] + dx"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L74_C12", "label": "y =", "type": "assigned_variable", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L72_C8", "vector": [14, 3, 0.1648, 0.0022, 3, 0.44, 0.5, 304, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " y = point[1] + dy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L75_C12", "label": "if", "type": "if", "loc": [75, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L72_C8", "vector": [4, 3, 0.1682, 0.0045, 3, 0.44, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if x >= 0 and x < img.width and y >= 0 and y < img.height: # and ( dx == 0 or dy == 0 ):\n neighbors.add( ( x, y ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L76_C16", "label": "add()", "type": "expression", "loc": [76, 76], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L75_C12", "vector": [8, 4, 0.1693, 0.0022, 4, 0.44, 0.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " neighbors.add( ( x, y ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L77_C4", "label": "return", "type": "return", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L69_C0", "vector": [13, 1, 0.1715, 0.0022, 1, 0.64, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return neighbors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L80_C0", "label": "create_region", "type": "function", "loc": [80, 93], "level": 0, "parent": null, "vector": [2, 0, 0.1927, 0.0312, 0, 0.66, 0.2857, 858, 0, 3, 1, 0, 0, 0, 9], "semantic": {"name": "create_region", "arg_names": ["img", "point", "cutoff"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_region( img, point, cutoff=10 ):\n region = set()\n region.add( point )\n neighbors = get_neighbors( img, point )\n while len( neighbors ) > 0:\n far_neighbors = set()\n for neighbor in neighbors:\n if neighbor not in region and merge_criterion( img, point, neighbor, cutoff ):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L81_C4", "label": "region = set()", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L80_C0", "vector": [14, 1, 0.1804, 0.0022, 1, 0.3, 0.0, 814, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "region", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " region = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L82_C4", "label": "add()", "type": "expression", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L80_C0", "vector": [8, 1, 0.1826, 0.0022, 1, 0.3, 0.25, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " region.add( point )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L83_C4", "label": "neighbors = get_neighbors()", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L80_C0", "vector": [14, 1, 0.1849, 0.0022, 1, 0.3, 0.5, 227, 3, 2, 0, 0, 341, 10, 1], "semantic": {"name": "neighbors", "arg_names": [], "import_names": [], "rhs_call_name": "get_neighbors", "annotation": ""}, "snippet": " neighbors = get_neighbors( img, point )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L84_C4", "label": "while", "type": "while", "loc": [84, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L80_C0", "vector": [5, 1, 0.196, 0.02, 1, 0.3, 0.75, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while len( neighbors ) > 0:\n far_neighbors = set()\n for neighbor in neighbors:\n if neighbor not in region and merge_criterion( img, point, neighbor, cutoff ):\n region.add( neighbor )\n for far_neighbor in get_neighbors( img, neighbor ):\n if far_neighbor not in region:\n far_neighbors.add( far_neighbor )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L85_C8", "label": "far_neighbors = set()", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L84_C4", "vector": [14, 2, 0.1893, 0.0022, 2, 0.23, 0.0, 579, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "far_neighbors", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " far_neighbors = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L86_C8", "label": "for neighbor", "type": "for", "loc": [86, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L84_C4", "vector": [6, 2, 0.1971, 0.0134, 2, 0.23, 0.5, 518, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "neighbor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for neighbor in neighbors:\n if neighbor not in region and merge_criterion( img, point, neighbor, cutoff ):\n region.add( neighbor )\n for far_neighbor in get_neighbors( img, neighbor ):\n if far_neighbor not in region:\n far_neighbors.add( far_neighbor )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L87_C12", "label": "if", "type": "if", "loc": [87, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L86_C8", "vector": [4, 3, 0.1982, 0.0111, 3, 0.06, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if neighbor not in region and merge_criterion( img, point, neighbor, cutoff ):\n region.add( neighbor )\n for far_neighbor in get_neighbors( img, neighbor ):\n if far_neighbor not in region:\n far_neighbors.add( far_neighbor )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L88_C16", "label": "add()", "type": "expression", "loc": [88, 88], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L87_C12", "vector": [8, 4, 0.196, 0.0022, 4, 0.59, 0.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " region.add( neighbor )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L89_C16", "label": "for far_neighbor", "type": "for", "loc": [89, 91], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L87_C12", "vector": [6, 4, 0.2004, 0.0067, 4, 0.59, 1.0, 83, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "far_neighbor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for far_neighbor in get_neighbors( img, neighbor ):\n if far_neighbor not in region:\n far_neighbors.add( far_neighbor )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L90_C20", "label": "if", "type": "if", "loc": [90, 91], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L89_C16", "vector": [4, 5, 0.2016, 0.0045, 5, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if far_neighbor not in region:\n far_neighbors.add( far_neighbor )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L91_C24", "label": "add()", "type": "expression", "loc": [91, 91], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L90_C20", "vector": [8, 6, 0.2027, 0.0022, 6, 0.43, 0.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " far_neighbors.add( far_neighbor )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L92_C8", "label": "neighbors =", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L84_C4", "vector": [14, 2, 0.2049, 0.0022, 2, 0.23, 1.0, 227, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "neighbors", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " neighbors = far_neighbors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L93_C4", "label": "return", "type": "return", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L80_C0", "vector": [13, 1, 0.2071, 0.0022, 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 region"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L95_C0", "label": "merge_criterion", "type": "function", "loc": [95, 98], "level": 0, "parent": null, "vector": [2, 0, 0.2149, 0.0089, 0, 0.66, 0.3143, 455, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "merge_criterion", "arg_names": ["img", "pt_one", "pt_two", "cutoff"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def merge_criterion( img, pt_one, pt_two, cutoff=10 ):\n # print \"pt_one: \" + str( pt_one ) + \", pt_two: \" + str( pt_two )+\", H:\"+str(img.height)+\", W:\"+str(img.width)\n difference = abs( img[pt_one[1], pt_one[0]] - img[pt_two[1], pt_two[0]] ) \n return difference < cutoff"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L97_C4", "label": "difference = abs()", "type": "assigned_variable", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L95_C0", "vector": [14, 1, 0.216, 0.0022, 1, 0.87, 0.0, 498, 3, 1, 0, 0, 799, 10, 1], "semantic": {"name": "difference", "arg_names": [], "import_names": [], "rhs_call_name": "abs", "annotation": ""}, "snippet": " difference = abs( img[pt_one[1], pt_one[0]] - img[pt_two[1], pt_two[0]] ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L98_C4", "label": "return", "type": "return", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L95_C0", "vector": [13, 1, 0.2183, 0.0022, 1, 0.87, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return difference < cutoff"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L100_C0", "label": "region_start", "type": "function", "loc": [100, 106], "level": 0, "parent": null, "vector": [2, 0, 0.2294, 0.0156, 0, 0.66, 0.3429, 475, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "region_start", "arg_names": ["region"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def region_start( region ):\n minx = 100000\n miny = 100000\n for point in region:\n minx = min( point[0], minx )\n miny = min( point[1], miny )\n return ( minx, miny )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L101_C4", "label": "minx =", "type": "assigned_variable", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L100_C0", "vector": [14, 1, 0.2249, 0.0022, 1, 0.83, 0.0, 176, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "minx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " minx = 100000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L102_C4", "label": "miny =", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L100_C0", "vector": [14, 1, 0.2272, 0.0022, 1, 0.83, 0.3333, 579, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "miny", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " miny = 100000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L103_C4", "label": "for point", "type": "for", "loc": [103, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L100_C0", "vector": [6, 1, 0.2316, 0.0067, 1, 0.83, 0.6667, 16, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for point in region:\n minx = min( point[0], minx )\n miny = min( point[1], miny )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L104_C8", "label": "minx = min()", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L103_C4", "vector": [14, 2, 0.2316, 0.0022, 2, 0.07, 0.0, 176, 3, 2, 0, 0, 867, 10, 1], "semantic": {"name": "minx", "arg_names": [], "import_names": [], "rhs_call_name": "min", "annotation": ""}, "snippet": " minx = min( point[0], minx )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L105_C8", "label": "miny = min()", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L103_C4", "vector": [14, 2, 0.2339, 0.0022, 2, 0.07, 1.0, 579, 3, 2, 0, 0, 867, 10, 1], "semantic": {"name": "miny", "arg_names": [], "import_names": [], "rhs_call_name": "min", "annotation": ""}, "snippet": " miny = min( point[1], miny )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L106_C4", "label": "return", "type": "return", "loc": [106, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L100_C0", "vector": [13, 1, 0.2361, 0.0022, 1, 0.83, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ( minx, miny )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L108_C0", "label": "region_leanness", "type": "function", "loc": [108, 109], "level": 0, "parent": null, "vector": [2, 0, 0.2416, 0.0045, 0, 0.66, 0.3714, 215, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "region_leanness", "arg_names": ["region"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def region_leanness( region ):\n return ( region_height( region ) + 0.0 ) / region_width( region )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L109_C4", "label": "return", "type": "return", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L108_C0", "vector": [13, 1, 0.2428, 0.0022, 1, 0.36, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ( region_height( region ) + 0.0 ) / region_width( region )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L111_C0", "label": "region_height", "type": "function", "loc": [111, 112], "level": 0, "parent": null, "vector": [2, 0, 0.2483, 0.0045, 0, 0.66, 0.4, 602, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "region_height", "arg_names": ["region"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def region_height( region ):\n return region_span( region, 1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L112_C4", "label": "return", "type": "return", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L111_C0", "vector": [13, 1, 0.2494, 0.0022, 1, 0.02, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return region_span( region, 1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L114_C0", "label": "region_width", "type": "function", "loc": [114, 115], "level": 0, "parent": null, "vector": [2, 0, 0.255, 0.0045, 0, 0.66, 0.4286, 112, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "region_width", "arg_names": ["region"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def region_width( region ):\n return region_span( region, 0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L115_C4", "label": "return", "type": "return", "loc": [115, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L114_C0", "vector": [13, 1, 0.2561, 0.0022, 1, 0.49, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return region_span( region, 0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L117_C0", "label": "region_center", "type": "function", "loc": [117, 122], "level": 0, "parent": null, "vector": [2, 0, 0.2661, 0.0134, 0, 0.66, 0.4571, 890, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "region_center", "arg_names": ["region"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def region_center( region ):\n sumx = sumy = 0\n for point in region:\n sumy += point[1]\n sumx += point[0]\n return ( 1.0 * sumx / len( region ), 1.0 * sumy / len( region ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L118_C4", "label": "sumx =", "type": "assigned_variable", "loc": [118, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L117_C0", "vector": [14, 1, 0.2628, 0.0022, 1, 0.42, 0.0, 996, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "sumx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sumx = sumy = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L119_C4", "label": "for point", "type": "for", "loc": [119, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L117_C0", "vector": [6, 1, 0.2673, 0.0067, 1, 0.42, 0.5, 16, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for point in region:\n sumy += point[1]\n sumx += point[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L122_C4", "label": "return", "type": "return", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L117_C0", "vector": [13, 1, 0.2717, 0.0022, 1, 0.42, 1.0, 0, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ( 1.0 * sumx / len( region ), 1.0 * sumy / len( region ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L124_C0", "label": "region_span", "type": "function", "loc": [124, 130], "level": 0, "parent": null, "vector": [2, 0, 0.2829, 0.0156, 0, 0.66, 0.4857, 700, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "region_span", "arg_names": ["region", "axis_index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def region_span( region, axis_index ):\n minh = 100000\n maxh = -100000\n for point in region:\n minh = min( point[axis_index], minh )\n maxh = max( point[axis_index], maxh )\n return maxh - minh + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L125_C4", "label": "minh =", "type": "assigned_variable", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L124_C0", "vector": [14, 1, 0.2784, 0.0022, 1, 0.59, 0.0, 721, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "minh", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " minh = 100000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L126_C4", "label": "maxh =", "type": "assigned_variable", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L124_C0", "vector": [14, 1, 0.2806, 0.0022, 1, 0.59, 0.3333, 318, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "maxh", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " maxh = -100000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L127_C4", "label": "for point", "type": "for", "loc": [127, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L124_C0", "vector": [6, 1, 0.2851, 0.0067, 1, 0.59, 0.6667, 16, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for point in region:\n minh = min( point[axis_index], minh )\n maxh = max( point[axis_index], maxh )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L128_C8", "label": "minh = min()", "type": "assigned_variable", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L127_C4", "vector": [14, 2, 0.2851, 0.0022, 2, 0.76, 0.0, 721, 3, 2, 0, 0, 867, 10, 1], "semantic": {"name": "minh", "arg_names": [], "import_names": [], "rhs_call_name": "min", "annotation": ""}, "snippet": " minh = min( point[axis_index], minh )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L129_C8", "label": "maxh = max()", "type": "assigned_variable", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L127_C4", "vector": [14, 2, 0.2873, 0.0022, 2, 0.76, 1.0, 318, 3, 2, 0, 0, 442, 10, 1], "semantic": {"name": "maxh", "arg_names": [], "import_names": [], "rhs_call_name": "max", "annotation": ""}, "snippet": " maxh = max( point[axis_index], maxh )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L130_C4", "label": "return", "type": "return", "loc": [130, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L124_C0", "vector": [13, 1, 0.2895, 0.0022, 1, 0.59, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return maxh - minh + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L134_C0", "label": "cropImage", "type": "function", "loc": [134, 141], "level": 0, "parent": null, "vector": [2, 0, 0.3062, 0.0178, 0, 0.66, 0.5143, 160, 0, 5, 1, 0, 0, 0, 7], "semantic": {"name": "cropImage", "arg_names": ["image", "xstart", "ystart", "xend", "yend"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def cropImage( image, xstart, ystart, xend, yend ):\n width = min( xend, image.width - 1 ) - xstart\n height = min( yend, image.height - 1 ) - ystart\n cv.CreateImage\n cropped = cv.CreateImage( ( width, height ), image.depth, image.nChannels )\n src_region = cv.GetSubRect( image, ( max( xstart, 0 ), max( ystart, 0 ), width, height ) )\n cv.Copy( src_region, cropped )\n return cropped"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L135_C4", "label": "width =", "type": "assigned_variable", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L134_C0", "vector": [14, 1, 0.3007, 0.0022, 1, 0.78, 0.0, 989, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "width", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " width = min( xend, image.width - 1 ) - xstart"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L136_C4", "label": "height =", "type": "assigned_variable", "loc": [136, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L134_C0", "vector": [14, 1, 0.3029, 0.0022, 1, 0.78, 0.1667, 751, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "height", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " height = min( yend, image.height - 1 ) - ystart"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L137_C4", "label": "expression", "type": "expression", "loc": [137, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L134_C0", "vector": [8, 1, 0.3051, 0.0022, 1, 0.78, 0.3333, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cv.CreateImage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L138_C4", "label": "cropped = CreateImage()", "type": "assigned_variable", "loc": [138, 138], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L134_C0", "vector": [14, 1, 0.3073, 0.0022, 1, 0.78, 0.5, 463, 3, 3, 0, 0, 288, 10, 1], "semantic": {"name": "cropped", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " cropped = cv.CreateImage( ( width, height ), image.depth, image.nChannels )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L139_C4", "label": "src_region = GetSubRect()", "type": "assigned_variable", "loc": [139, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L134_C0", "vector": [14, 1, 0.3096, 0.0022, 1, 0.78, 0.6667, 780, 3, 2, 0, 0, 469, 10, 3], "semantic": {"name": "src_region", "arg_names": [], "import_names": [], "rhs_call_name": "GetSubRect", "annotation": ""}, "snippet": " src_region = cv.GetSubRect( image, ( max( xstart, 0 ), max( ystart, 0 ), width, height ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L140_C4", "label": "Copy()", "type": "expression", "loc": [140, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L134_C0", "vector": [8, 1, 0.3118, 0.0022, 1, 0.78, 0.8333, 295, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Copy", "arg_names": [], "import_names": [], "rhs_call_name": "Copy", "annotation": ""}, "snippet": " cv.Copy( src_region, cropped )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L141_C4", "label": "return", "type": "return", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L134_C0", "vector": [13, 1, 0.314, 0.0022, 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 cropped"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L144_C0", "label": "grow_regions", "type": "function", "loc": [144, 157], "level": 0, "parent": null, "vector": [2, 0, 0.3352, 0.0312, 0, 0.66, 0.5429, 874, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "grow_regions", "arg_names": ["image", "seed_color", "eaten_color"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def grow_regions( image, seed_color=0, eaten_color=255 ):\n print(\"growing regions\")\n selected_regions = list()\n for y in range( 0, image.height ):\n for x in range( 0, image.width ):\n if image[y, x] == seed_color:\n region = create_region( image, ( x, y ), 25 )\n if len( region ) > 1:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L145_C4", "label": "print()", "type": "expression", "loc": [145, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L144_C0", "vector": [8, 1, 0.3229, 0.0022, 1, 0.4, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"growing regions\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L146_C4", "label": "selected_regions = list()", "type": "assigned_variable", "loc": [146, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L144_C0", "vector": [14, 1, 0.3252, 0.0022, 1, 0.4, 0.25, 359, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "selected_regions", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " selected_regions = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L147_C4", "label": "for y", "type": "for", "loc": [147, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L144_C0", "vector": [6, 1, 0.3363, 0.02, 1, 0.4, 0.5, 304, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for y in range( 0, image.height ):\n for x in range( 0, image.width ):\n if image[y, x] == seed_color:\n region = create_region( image, ( x, y ), 25 )\n if len( region ) > 1:\n selected_regions.append( region )\n \n for point in region:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L148_C8", "label": "for x", "type": "for", "loc": [148, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L147_C4", "vector": [6, 2, 0.3374, 0.0178, 2, 0.01, 0.0, 190, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in range( 0, image.width ):\n if image[y, x] == seed_color:\n region = create_region( image, ( x, y ), 25 )\n if len( region ) > 1:\n selected_regions.append( region )\n \n for point in region:\n image[point[1], point[0]] = eaten_color;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L149_C12", "label": "if", "type": "if", "loc": [149, 155], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L148_C8", "vector": [4, 3, 0.3385, 0.0156, 3, 0.49, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if image[y, x] == seed_color:\n region = create_region( image, ( x, y ), 25 )\n if len( region ) > 1:\n selected_regions.append( region )\n \n for point in region:\n image[point[1], point[0]] = eaten_color;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L150_C16", "label": "region = create_region()", "type": "assigned_variable", "loc": [150, 150], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L149_C12", "vector": [14, 4, 0.3341, 0.0022, 4, 0.2, 0.0, 814, 3, 3, 0, 0, 858, 10, 1], "semantic": {"name": "region", "arg_names": [], "import_names": [], "rhs_call_name": "create_region", "annotation": ""}, "snippet": " region = create_region( image, ( x, y ), 25 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L151_C16", "label": "if", "type": "if", "loc": [151, 152], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L149_C12", "vector": [4, 4, 0.3374, 0.0045, 4, 0.2, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len( region ) > 1:\n selected_regions.append( region )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L152_C20", "label": "append()", "type": "expression", "loc": [152, 152], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L151_C16", "vector": [8, 5, 0.3385, 0.0022, 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": " selected_regions.append( region )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L154_C16", "label": "for point", "type": "for", "loc": [154, 155], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L149_C12", "vector": [6, 4, 0.3441, 0.0045, 4, 0.2, 1.0, 16, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for point in region:\n image[point[1], point[0]] = eaten_color;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L155_C20", "label": "assign", "type": "assigned_variable", "loc": [155, 155], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L154_C16", "vector": [14, 5, 0.3452, 0.0022, 5, 0.3, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " image[point[1], point[0]] = eaten_color;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L156_C4", "label": "paint_regions()", "type": "expression", "loc": [156, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L144_C0", "vector": [8, 1, 0.3474, 0.0022, 1, 0.4, 0.75, 207, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "paint_regions", "arg_names": [], "import_names": [], "rhs_call_name": "paint_regions", "annotation": ""}, "snippet": " paint_regions( selected_regions, image )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L157_C4", "label": "return", "type": "return", "loc": [157, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L144_C0", "vector": [13, 1, 0.3497, 0.0022, 1, 0.4, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return selected_regions"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L160_C0", "label": "kill_the_losers", "type": "function", "loc": [160, 175], "level": 0, "parent": null, "vector": [2, 0, 0.3731, 0.0356, 0, 0.66, 0.5714, 559, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "kill_the_losers", "arg_names": ["org_img", "regions"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def kill_the_losers( org_img, regions ):\n sf = 4\n truth = True\n while truth:\n truth = False\n for i in range( 0, len( regions ) ):\n # ratio_criterion = len( regions[i] ) * sf / region_height( regions[i] ) < region_width( regions[i] ) or len( regions[i] ) * sf / region_width( regions[i] ) < region_height( regions[i] ) \n length_criterion = region_width( regions[i] ) < 1.5 * region_height( regions[i] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L161_C4", "label": "sf =", "type": "assigned_variable", "loc": [161, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L160_C0", "vector": [14, 1, 0.3586, 0.0022, 1, 0.75, 0.0, 834, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "sf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sf = 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L162_C4", "label": "truth =", "type": "assigned_variable", "loc": [162, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L160_C0", "vector": [14, 1, 0.3608, 0.0022, 1, 0.75, 0.25, 328, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "truth", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " truth = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L163_C4", "label": "while", "type": "while", "loc": [163, 173], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L160_C0", "vector": [5, 1, 0.3742, 0.0245, 1, 0.75, 0.5, 0, 2, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while truth:\n truth = False\n for i in range( 0, len( regions ) ):\n # ratio_criterion = len( regions[i] ) * sf / region_height( regions[i] ) < region_width( regions[i] ) or len( regions[i] ) * sf / region_width( regions[i] ) < region_height( regions[i] ) \n length_criterion = region_width( regions[i] ) < 1.5 * region_height( regions[i] )\n height_criterion = region_height( regions[i] ) < org_img.height * 0.02\n size_criterion = len( regions[i] ) < 4 * optimal_radius( org_img )\n if size_criterion or length_criterion or height_criterion:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L164_C8", "label": "truth =", "type": "assigned_variable", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L163_C4", "vector": [14, 2, 0.3653, 0.0022, 2, 0.94, 0.0, 328, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "truth", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " truth = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L165_C8", "label": "for i", "type": "for", "loc": [165, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L163_C4", "vector": [6, 2, 0.3764, 0.02, 2, 0.94, 1.0, 826, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range( 0, len( regions ) ):\n # ratio_criterion = len( regions[i] ) * sf / region_height( regions[i] ) < region_width( regions[i] ) or len( regions[i] ) * sf / region_width( regions[i] ) < region_height( regions[i] ) \n length_criterion = region_width( regions[i] ) < 1.5 * region_height( regions[i] )\n height_criterion = region_height( regions[i] ) < org_img.height * 0.02\n size_criterion = len( regions[i] ) < 4 * optimal_radius( org_img )\n if size_criterion or length_criterion or height_criterion:\n truth = True\n regions.pop( i )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L167_C12", "label": "length_criterion =", "type": "assigned_variable", "loc": [167, 167], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L165_C8", "vector": [14, 3, 0.3719, 0.0022, 3, 0.14, 0.0, 976, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "length_criterion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " length_criterion = region_width( regions[i] ) < 1.5 * region_height( regions[i] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L168_C12", "label": "height_criterion =", "type": "assigned_variable", "loc": [168, 168], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L165_C8", "vector": [14, 3, 0.3742, 0.0022, 3, 0.14, 0.3333, 565, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "height_criterion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " height_criterion = region_height( regions[i] ) < org_img.height * 0.02"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L169_C12", "label": "size_criterion =", "type": "assigned_variable", "loc": [169, 169], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L165_C8", "vector": [14, 3, 0.3764, 0.0022, 3, 0.14, 0.6667, 17, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "size_criterion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " size_criterion = len( regions[i] ) < 4 * optimal_radius( org_img )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L170_C12", "label": "if", "type": "if", "loc": [170, 173], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L165_C8", "vector": [4, 3, 0.382, 0.0089, 3, 0.14, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if size_criterion or length_criterion or height_criterion:\n truth = True\n regions.pop( i )\n break;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L171_C16", "label": "truth =", "type": "assigned_variable", "loc": [171, 171], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L170_C12", "vector": [14, 4, 0.3808, 0.0022, 4, 0.48, 0.0, 328, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "truth", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " truth = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L172_C16", "label": "pop()", "type": "expression", "loc": [172, 172], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L170_C12", "vector": [8, 4, 0.3831, 0.0022, 4, 0.48, 1.0, 969, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pop", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " regions.pop( i )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L174_C4", "label": "paint_regions()", "type": "expression", "loc": [174, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L160_C0", "vector": [8, 1, 0.3875, 0.0022, 1, 0.75, 0.75, 207, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "paint_regions", "arg_names": [], "import_names": [], "rhs_call_name": "paint_regions", "annotation": ""}, "snippet": " paint_regions( regions, org_img )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L175_C4", "label": "return", "type": "return", "loc": [175, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L160_C0", "vector": [13, 1, 0.3898, 0.0022, 1, 0.75, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return regions"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "label": "cluster_regions", "type": "function", "loc": [179, 227], "level": 0, "parent": null, "vector": [2, 0, 0.4521, 0.1091, 0, 0.66, 0.6, 202, 0, 2, 1, 0, 0, 0, 35], "semantic": {"name": "cluster_regions", "arg_names": ["org_img", "regions"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def cluster_regions ( org_img, regions ):\n \n starts = list()\n heights = list()\n widths = list()\n centers = list()\n\n # init data for merging "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L181_C4", "label": "starts = list()", "type": "assigned_variable", "loc": [181, 181], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "vector": [14, 1, 0.4031, 0.0022, 1, 0.77, 0.0, 730, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "starts", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " starts = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L182_C4", "label": "heights = list()", "type": "assigned_variable", "loc": [182, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "vector": [14, 1, 0.4053, 0.0022, 1, 0.77, 0.1, 410, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "heights", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " heights = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L183_C4", "label": "widths = list()", "type": "assigned_variable", "loc": [183, 183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "vector": [14, 1, 0.4076, 0.0022, 1, 0.77, 0.2, 291, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "widths", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " widths = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L184_C4", "label": "centers = list()", "type": "assigned_variable", "loc": [184, 184], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "vector": [14, 1, 0.4098, 0.0022, 1, 0.77, 0.3, 21, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "centers", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " centers = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L187_C4", "label": "for region", "type": "for", "loc": [187, 192], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "vector": [6, 1, 0.422, 0.0134, 1, 0.77, 0.4, 814, 2, 0, 0, 0, 0, 0, 8], "semantic": {"name": "region", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for region in regions:\n start = region_start( region )\n starts.append( start )\n heights.append( region_height( region ) )\n widths.append( region_width( region ) )\n centers.append( region_center( region ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L188_C8", "label": "start = region_start()", "type": "assigned_variable", "loc": [188, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L187_C4", "vector": [14, 2, 0.4187, 0.0022, 2, 0.81, 0.0, 511, 3, 1, 0, 0, 475, 10, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "region_start", "annotation": ""}, "snippet": " start = region_start( region )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L189_C8", "label": "append()", "type": "expression", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L187_C4", "vector": [8, 2, 0.4209, 0.0022, 2, 0.81, 0.25, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " starts.append( start )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L190_C8", "label": "append()", "type": "expression", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L187_C4", "vector": [8, 2, 0.4232, 0.0022, 2, 0.81, 0.5, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " heights.append( region_height( region ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L191_C8", "label": "append()", "type": "expression", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L187_C4", "vector": [8, 2, 0.4254, 0.0022, 2, 0.81, 0.75, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " widths.append( region_width( region ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L192_C8", "label": "append()", "type": "expression", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L187_C4", "vector": [8, 2, 0.4276, 0.0022, 2, 0.81, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " centers.append( region_center( region ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L195_C4", "label": "truth =", "type": "assigned_variable", "loc": [195, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "vector": [14, 1, 0.4343, 0.0022, 1, 0.77, 0.5, 328, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "truth", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " truth = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L196_C4", "label": "iterations_counter =", "type": "assigned_variable", "loc": [196, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "vector": [14, 1, 0.4365, 0.0022, 1, 0.77, 0.6, 149, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "iterations_counter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " iterations_counter = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L197_C4", "label": "while", "type": "while", "loc": [197, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "vector": [5, 1, 0.4688, 0.0624, 1, 0.77, 0.7, 0, 0, 0, 0, 0, 0, 0, 21], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while truth and len( regions ) > 1:\n iterations_counter += 1\n if iterations_counter % 25 == 0:\n print(\"clustering regions...\")\n for i in range( 0, len( regions ) ):\n truth = False\n for j in range( i + 1, len( regions ) ):\n joint_mass = len( regions[i] ) + len( regions[j] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L199_C8", "label": "if", "type": "if", "loc": [199, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L197_C4", "vector": [4, 2, 0.4443, 0.0045, 2, 0.74, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if iterations_counter % 25 == 0:\n print(\"clustering regions...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L200_C12", "label": "print()", "type": "expression", "loc": [200, 200], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L199_C8", "vector": [8, 3, 0.4454, 0.0022, 3, 0.47, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"clustering regions...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L201_C8", "label": "for i", "type": "for", "loc": [201, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L197_C4", "vector": [6, 2, 0.4733, 0.0535, 2, 0.74, 1.0, 826, 3, 0, 0, 0, 0, 0, 19], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range( 0, len( regions ) ):\n truth = False\n for j in range( i + 1, len( regions ) ):\n joint_mass = len( regions[i] ) + len( regions[j] )\n gravity_criterion = ( ( centers[i][0] - centers[j][0] ) ** 2 + ( centers[i][1] - centers[j][1] ) ** 2 ) < 50 * ( joint_mass ) \n horizontal_criterion = ( centers[i][0] - centers[j][0] ) ** 2 < 40 * joint_mass\n vertical_criterion = ( centers[i][1] - centers[j][1] ) ** 2 < joint_mass\n width_criterion = widths[i] + widths[j] + abs( centers[i][0] - centers[j][0] ) < 2 * len( regions[i] ) + len( regions[j] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L202_C12", "label": "truth =", "type": "assigned_variable", "loc": [202, 202], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L201_C8", "vector": [14, 3, 0.4499, 0.0022, 3, 0.48, 0.0, 328, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "truth", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " truth = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L203_C12", "label": "for j", "type": "for", "loc": [203, 222], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L201_C8", "vector": [6, 3, 0.4733, 0.0445, 3, 0.48, 0.5, 100, 3, 0, 0, 0, 0, 0, 17], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for j in range( i + 1, len( regions ) ):\n joint_mass = len( regions[i] ) + len( regions[j] )\n gravity_criterion = ( ( centers[i][0] - centers[j][0] ) ** 2 + ( centers[i][1] - centers[j][1] ) ** 2 ) < 50 * ( joint_mass ) \n horizontal_criterion = ( centers[i][0] - centers[j][0] ) ** 2 < 40 * joint_mass\n vertical_criterion = ( centers[i][1] - centers[j][1] ) ** 2 < joint_mass\n width_criterion = widths[i] + widths[j] + abs( centers[i][0] - centers[j][0] ) < 2 * len( regions[i] ) + len( regions[j] )\n if ( gravity_criterion and width_criterion and vertical_criterion and horizontal_criterion ):\n truth = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L204_C16", "label": "joint_mass =", "type": "assigned_variable", "loc": [204, 204], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L203_C12", "vector": [14, 4, 0.4543, 0.0022, 4, 0.01, 0.0, 775, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "joint_mass", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " joint_mass = len( regions[i] ) + len( regions[j] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L205_C16", "label": "gravity_criterion =", "type": "assigned_variable", "loc": [205, 205], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L203_C12", "vector": [14, 4, 0.4566, 0.0022, 4, 0.01, 0.2, 300, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "gravity_criterion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " gravity_criterion = ( ( centers[i][0] - centers[j][0] ) ** 2 + ( centers[i][1] - centers[j][1] ) ** 2 ) < 50 * ( joint_mass ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L206_C16", "label": "horizontal_criterion =", "type": "assigned_variable", "loc": [206, 206], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L203_C12", "vector": [14, 4, 0.4588, 0.0022, 4, 0.01, 0.4, 218, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "horizontal_criterion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " horizontal_criterion = ( centers[i][0] - centers[j][0] ) ** 2 < 40 * joint_mass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L207_C16", "label": "vertical_criterion =", "type": "assigned_variable", "loc": [207, 207], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L203_C12", "vector": [14, 4, 0.461, 0.0022, 4, 0.01, 0.6, 462, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "vertical_criterion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vertical_criterion = ( centers[i][1] - centers[j][1] ) ** 2 < joint_mass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L208_C16", "label": "width_criterion =", "type": "assigned_variable", "loc": [208, 208], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L203_C12", "vector": [14, 4, 0.4633, 0.0022, 4, 0.01, 0.8, 621, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "width_criterion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " width_criterion = widths[i] + widths[j] + abs( centers[i][0] - centers[j][0] ) < 2 * len( regions[i] ) + len( regions[j] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "label": "if", "type": "if", "loc": [209, 222], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L203_C12", "vector": [4, 4, 0.48, 0.0312, 4, 0.01, 1.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ( gravity_criterion and width_criterion and vertical_criterion and horizontal_criterion ):\n truth = True\n regions[i] = regions[i].union( regions[j] )\n heights[i] = region_height( regions[i] )\n widths[i] = region_width( regions[i] )\n starts[i] = region_start( regions[i] )\n centers[i] = region_center( regions[i] )\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L210_C20", "label": "truth =", "type": "assigned_variable", "loc": [210, 210], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "vector": [14, 5, 0.4677, 0.0022, 5, 0.67, 0.0, 328, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "truth", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " truth = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L211_C20", "label": " = union()", "type": "assigned_variable", "loc": [211, 211], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "vector": [14, 5, 0.4699, 0.0022, 5, 0.67, 0.1, 0, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "union", "annotation": ""}, "snippet": " regions[i] = regions[i].union( regions[j] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L212_C20", "label": " = region_height()", "type": "assigned_variable", "loc": [212, 212], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "vector": [14, 5, 0.4722, 0.0022, 5, 0.67, 0.2, 0, 3, 1, 0, 0, 602, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "region_height", "annotation": ""}, "snippet": " heights[i] = region_height( regions[i] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L213_C20", "label": " = region_width()", "type": "assigned_variable", "loc": [213, 213], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "vector": [14, 5, 0.4744, 0.0022, 5, 0.67, 0.3, 0, 3, 1, 0, 0, 112, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "region_width", "annotation": ""}, "snippet": " widths[i] = region_width( regions[i] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L214_C20", "label": " = region_start()", "type": "assigned_variable", "loc": [214, 214], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "vector": [14, 5, 0.4766, 0.0022, 5, 0.67, 0.4, 0, 3, 1, 0, 0, 475, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "region_start", "annotation": ""}, "snippet": " starts[i] = region_start( regions[i] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L215_C20", "label": " = region_center()", "type": "assigned_variable", "loc": [215, 215], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "vector": [14, 5, 0.4788, 0.0022, 5, 0.67, 0.5, 0, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "region_center", "annotation": ""}, "snippet": " centers[i] = region_center( regions[i] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L217_C20", "label": "pop()", "type": "expression", "loc": [217, 217], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "vector": [8, 5, 0.4833, 0.0022, 5, 0.67, 0.6, 969, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pop", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " regions.pop( j )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L218_C20", "label": "pop()", "type": "expression", "loc": [218, 218], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "vector": [8, 5, 0.4855, 0.0022, 5, 0.67, 0.7, 969, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pop", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " heights.pop( j )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L219_C20", "label": "pop()", "type": "expression", "loc": [219, 219], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "vector": [8, 5, 0.4878, 0.0022, 5, 0.67, 0.8, 969, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pop", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " widths.pop( j )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L220_C20", "label": "pop()", "type": "expression", "loc": [220, 220], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "vector": [8, 5, 0.49, 0.0022, 5, 0.67, 0.9, 969, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pop", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " centers.pop( j )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L221_C20", "label": "pop()", "type": "expression", "loc": [221, 221], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "vector": [8, 5, 0.4922, 0.0022, 5, 0.67, 1.0, 969, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pop", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " starts.pop( j )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L223_C12", "label": "if", "type": "if", "loc": [223, 224], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L201_C8", "vector": [4, 3, 0.4978, 0.0045, 3, 0.48, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if truth:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L225_C4", "label": "paint_regions()", "type": "expression", "loc": [225, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "vector": [8, 1, 0.5011, 0.0022, 1, 0.77, 0.8, 207, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "paint_regions", "arg_names": [], "import_names": [], "rhs_call_name": "paint_regions", "annotation": ""}, "snippet": " paint_regions( regions, org_img )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L226_C4", "label": "print()", "type": "expression", "loc": [226, 226], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "vector": [8, 1, 0.5033, 0.0022, 1, 0.77, 0.9, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"all suitable regions merged\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L227_C4", "label": "return", "type": "return", "loc": [227, 227], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "vector": [13, 1, 0.5056, 0.0022, 1, 0.77, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return regions"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L229_C0", "label": "paint_regions", "type": "function", "loc": [229, 242], "level": 0, "parent": null, "vector": [2, 0, 0.5245, 0.0312, 0, 0.66, 0.6286, 207, 0, 3, 0, 0, 0, 0, 6], "semantic": {"name": "paint_regions", "arg_names": ["regions", "image", "caption"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def paint_regions( regions, image, caption=\"cpoo\" ):\n res = cv.CreateImage( cv.GetSize( image ), image.depth, 3 )\n # assumes 3-channeled original \n for x in range ( 0, res.width ):\n for y in range( 0, res.height ):\n res[y, x] = ( 0, 0, 0 )\n colors = [( 0, 0, 255 ), ( 0, 255, 0 ), ( 255, 0, 0 ), ( 255, 0, 255 ), ( 255, 255, 0 ), ( 0, 0, 255 ), ( 255, 255, 255 )]\n color_counter = 0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L230_C4", "label": "res = CreateImage()", "type": "assigned_variable", "loc": [230, 230], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L229_C0", "vector": [14, 1, 0.5122, 0.0022, 1, 0.43, 0.0, 413, 3, 3, 0, 0, 288, 10, 2], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " res = cv.CreateImage( cv.GetSize( image ), image.depth, 3 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L232_C4", "label": "for x", "type": "for", "loc": [232, 234], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L229_C0", "vector": [6, 1, 0.5189, 0.0067, 1, 0.43, 0.2, 190, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in range ( 0, res.width ):\n for y in range( 0, res.height ):\n res[y, x] = ( 0, 0, 0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L233_C8", "label": "for y", "type": "for", "loc": [233, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L232_C4", "vector": [6, 2, 0.52, 0.0045, 2, 0.52, 0.0, 304, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for y in range( 0, res.height ):\n res[y, x] = ( 0, 0, 0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L234_C12", "label": "assign", "type": "assigned_variable", "loc": [234, 234], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L233_C8", "vector": [14, 3, 0.5212, 0.0022, 3, 0.64, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res[y, x] = ( 0, 0, 0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L235_C4", "label": "colors =", "type": "assigned_variable", "loc": [235, 235], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L229_C0", "vector": [14, 1, 0.5234, 0.0022, 1, 0.43, 0.4, 656, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "colors", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " colors = [( 0, 0, 255 ), ( 0, 255, 0 ), ( 255, 0, 0 ), ( 255, 0, 255 ), ( 255, 255, 0 ), ( 0, 0, 255 ), ( 255, 255, 255 )]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L236_C4", "label": "color_counter =", "type": "assigned_variable", "loc": [236, 236], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L229_C0", "vector": [14, 1, 0.5256, 0.0022, 1, 0.43, 0.6, 589, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "color_counter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " color_counter = 0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L238_C4", "label": "for region", "type": "for", "loc": [238, 241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L229_C0", "vector": [6, 1, 0.5334, 0.0089, 1, 0.43, 0.8, 814, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "region", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for region in regions:\n color_counter = ( ( color_counter + 1 ) % len( colors ) )\n for point in region:\n res[point[1], point[0]] = colors[color_counter]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L239_C8", "label": "color_counter =", "type": "assigned_variable", "loc": [239, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L238_C4", "vector": [14, 2, 0.5323, 0.0022, 2, 0.19, 0.0, 589, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "color_counter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " color_counter = ( ( color_counter + 1 ) % len( colors ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L240_C8", "label": "for point", "type": "for", "loc": [240, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L238_C4", "vector": [6, 2, 0.5356, 0.0045, 2, 0.19, 1.0, 16, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for point in region:\n res[point[1], point[0]] = colors[color_counter]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L241_C12", "label": "assign", "type": "assigned_variable", "loc": [241, 241], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L240_C8", "vector": [14, 3, 0.5367, 0.0022, 3, 0.59, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res[point[1], point[0]] = colors[color_counter]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L242_C4", "label": "show_wait()", "type": "expression", "loc": [242, 242], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L229_C0", "vector": [8, 1, 0.539, 0.0022, 1, 0.43, 1.0, 33, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "show_wait", "arg_names": [], "import_names": [], "rhs_call_name": "show_wait", "annotation": ""}, "snippet": " show_wait( res, caption )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L244_C0", "label": "compare_pixels", "type": "function", "loc": [244, 254], "level": 0, "parent": null, "vector": [2, 0, 0.5546, 0.0245, 0, 0.66, 0.6571, 772, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "compare_pixels", "arg_names": ["p1", "p2", "tolerance"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def compare_pixels( p1, p2, tolerance ):\n diff = 0\n if isinstance ( p1, collections.Iterable ):\n temp_tolerance = 0\n for dim in range( 0, len( p1 ) ):\n diff += abs( p1[dim] - p2[dim] )\n temp_tolerance += tolerance\n tolerance = temp_tolerance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L245_C4", "label": "diff =", "type": "assigned_variable", "loc": [245, 245], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L244_C0", "vector": [14, 1, 0.5457, 0.0022, 1, 0.21, 0.0, 833, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "diff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " diff = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L246_C4", "label": "if", "type": "if", "loc": [246, 253], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L244_C0", "vector": [4, 1, 0.5557, 0.0178, 1, 0.21, 0.5, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance ( p1, collections.Iterable ):\n temp_tolerance = 0\n for dim in range( 0, len( p1 ) ):\n diff += abs( p1[dim] - p2[dim] )\n temp_tolerance += tolerance\n tolerance = temp_tolerance\n else:\n diff = abs( p1 - p2 );"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L247_C8", "label": "temp_tolerance =", "type": "assigned_variable", "loc": [247, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L246_C4", "vector": [14, 2, 0.5501, 0.0022, 2, 0.84, 0.0, 841, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "temp_tolerance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " temp_tolerance = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L248_C8", "label": "for dim", "type": "for", "loc": [248, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L246_C4", "vector": [6, 2, 0.5546, 0.0067, 2, 0.84, 0.3333, 596, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "dim", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for dim in range( 0, len( p1 ) ):\n diff += abs( p1[dim] - p2[dim] )\n temp_tolerance += tolerance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L251_C8", "label": "tolerance =", "type": "assigned_variable", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L246_C4", "vector": [14, 2, 0.559, 0.0022, 2, 0.84, 0.6667, 632, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tolerance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tolerance = temp_tolerance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L253_C8", "label": "diff = abs()", "type": "assigned_variable", "loc": [253, 253], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L246_C4", "vector": [14, 2, 0.5635, 0.0022, 2, 0.84, 1.0, 833, 3, 1, 0, 0, 799, 10, 1], "semantic": {"name": "diff", "arg_names": [], "import_names": [], "rhs_call_name": "abs", "annotation": ""}, "snippet": " diff = abs( p1 - p2 );"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L254_C4", "label": "return", "type": "return", "loc": [254, 254], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L244_C0", "vector": [13, 1, 0.5657, 0.0022, 1, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return diff < tolerance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L258_C0", "label": "optimal_radius", "type": "function", "loc": [258, 259], "level": 0, "parent": null, "vector": [2, 0, 0.5757, 0.0045, 0, 0.66, 0.6857, 179, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "optimal_radius", "arg_names": ["picture"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def optimal_radius( picture ):\n return picture.height / 30"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L259_C4", "label": "return", "type": "return", "loc": [259, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L258_C0", "vector": [13, 1, 0.5768, 0.0022, 1, 0.63, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return picture.height / 30"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "label": "text_energy_map", "type": "function", "loc": [262, 334], "level": 0, "parent": null, "vector": [2, 0, 0.6637, 0.1626, 0, 0.66, 0.7143, 235, 0, 1, 1, 0, 0, 0, 47], "semantic": {"name": "text_energy_map", "arg_names": ["image"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def text_energy_map( image ):\n image = split_channels( image )\n radius = optimal_radius( image )\n \n laplac = laplacian( image )\n laplac = gaussian_blur_icl( laplac, ( radius, radius ), radius )\n \n # init compass results"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L263_C4", "label": "image = split_channels()", "type": "assigned_variable", "loc": [263, 263], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [14, 1, 0.5857, 0.0022, 1, 0.59, 0.0, 505, 3, 1, 0, 0, 571, 10, 1], "semantic": {"name": "image", "arg_names": [], "import_names": [], "rhs_call_name": "split_channels", "annotation": ""}, "snippet": " image = split_channels( image )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L264_C4", "label": "radius = optimal_radius()", "type": "assigned_variable", "loc": [264, 264], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [14, 1, 0.588, 0.0022, 1, 0.59, 0.0244, 731, 3, 1, 0, 0, 179, 10, 1], "semantic": {"name": "radius", "arg_names": [], "import_names": [], "rhs_call_name": "optimal_radius", "annotation": ""}, "snippet": " radius = optimal_radius( image )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L266_C4", "label": "laplac = laplacian()", "type": "assigned_variable", "loc": [266, 266], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [14, 1, 0.5924, 0.0022, 1, 0.59, 0.0488, 169, 3, 1, 0, 0, 429, 10, 1], "semantic": {"name": "laplac", "arg_names": [], "import_names": [], "rhs_call_name": "laplacian", "annotation": ""}, "snippet": " laplac = laplacian( image )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L267_C4", "label": "laplac = gaussian_blur_icl()", "type": "assigned_variable", "loc": [267, 267], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [14, 1, 0.5947, 0.0022, 1, 0.59, 0.0732, 169, 3, 3, 0, 0, 207, 10, 1], "semantic": {"name": "laplac", "arg_names": [], "import_names": [], "rhs_call_name": "gaussian_blur_icl", "annotation": ""}, "snippet": " laplac = gaussian_blur_icl( laplac, ( radius, radius ), radius )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L270_C4", "label": "result_0 = CreateImage()", "type": "assigned_variable", "loc": [270, 270], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [14, 1, 0.6013, 0.0022, 1, 0.59, 0.0976, 790, 3, 3, 0, 0, 288, 10, 2], "semantic": {"name": "result_0", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " result_0 = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L271_C4", "label": "result_45 = CreateImage()", "type": "assigned_variable", "loc": [271, 271], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [14, 1, 0.6036, 0.0022, 1, 0.59, 0.122, 468, 3, 3, 0, 0, 288, 10, 2], "semantic": {"name": "result_45", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " result_45 = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L272_C4", "label": "result_90 = CreateImage()", "type": "assigned_variable", "loc": [272, 272], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [14, 1, 0.6058, 0.0022, 1, 0.59, 0.1463, 590, 3, 3, 0, 0, 288, 10, 2], "semantic": {"name": "result_90", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " result_90 = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L273_C4", "label": "result_135 = CreateImage()", "type": "assigned_variable", "loc": [273, 273], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [14, 1, 0.608, 0.0022, 1, 0.59, 0.1707, 827, 3, 3, 0, 0, 288, 10, 2], "semantic": {"name": "result_135", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " result_135 = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L276_C4", "label": "ker_0 = CreateMat()", "type": "assigned_variable", "loc": [276, 276], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [14, 1, 0.6147, 0.0022, 1, 0.59, 0.1951, 213, 3, 3, 0, 0, 892, 10, 1], "semantic": {"name": "ker_0", "arg_names": [], "import_names": [], "rhs_call_name": "CreateMat", "annotation": ""}, "snippet": " ker_0 = cv.CreateMat( 3, 3, cv.CV_8S )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L277_C4", "label": "Set()", "type": "expression", "loc": [277, 277], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.6169, 0.0022, 1, 0.59, 0.2195, 438, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Set", "arg_names": [], "import_names": [], "rhs_call_name": "Set", "annotation": ""}, "snippet": " cv.Set( ker_0, -1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L278_C4", "label": "Set()", "type": "expression", "loc": [278, 278], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.6192, 0.0022, 1, 0.59, 0.2439, 438, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Set", "arg_names": [], "import_names": [], "rhs_call_name": "Set", "annotation": ""}, "snippet": " cv.Set( ker_0[1, :], 2 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L279_C4", "label": "Filter2D()", "type": "expression", "loc": [279, 279], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.6214, 0.0022, 1, 0.59, 0.2683, 542, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "Filter2D", "arg_names": [], "import_names": [], "rhs_call_name": "Filter2D", "annotation": ""}, "snippet": " cv.Filter2D( image, result_0, ker_0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L282_C4", "label": "ker_45 = CreateMat()", "type": "assigned_variable", "loc": [282, 282], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [14, 1, 0.6281, 0.0022, 1, 0.59, 0.2927, 684, 3, 3, 0, 0, 892, 10, 1], "semantic": {"name": "ker_45", "arg_names": [], "import_names": [], "rhs_call_name": "CreateMat", "annotation": ""}, "snippet": " ker_45 = cv.CreateMat( 3, 3, cv.CV_8S )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L283_C4", "label": "Set()", "type": "expression", "loc": [283, 283], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.6303, 0.0022, 1, 0.59, 0.3171, 438, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Set", "arg_names": [], "import_names": [], "rhs_call_name": "Set", "annotation": ""}, "snippet": " cv.Set( ker_45, -1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L284_C4", "label": "assign", "type": "assigned_variable", "loc": [284, 284], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [14, 1, 0.6325, 0.0022, 1, 0.59, 0.3415, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ker_45[2, 2] = ker_45[1, 1] = ker_45[0, 0] = 2;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L285_C4", "label": "Filter2D()", "type": "expression", "loc": [285, 285], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.6347, 0.0022, 1, 0.59, 0.3659, 542, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "Filter2D", "arg_names": [], "import_names": [], "rhs_call_name": "Filter2D", "annotation": ""}, "snippet": " cv.Filter2D( image, result_45, ker_45 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L288_C4", "label": "ker_90 = CreateMat()", "type": "assigned_variable", "loc": [288, 288], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [14, 1, 0.6414, 0.0022, 1, 0.59, 0.3902, 257, 3, 3, 0, 0, 892, 10, 1], "semantic": {"name": "ker_90", "arg_names": [], "import_names": [], "rhs_call_name": "CreateMat", "annotation": ""}, "snippet": " ker_90 = cv.CreateMat( 3, 3, cv.CV_8S )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L289_C4", "label": "Set()", "type": "expression", "loc": [289, 289], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.6437, 0.0022, 1, 0.59, 0.4146, 438, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Set", "arg_names": [], "import_names": [], "rhs_call_name": "Set", "annotation": ""}, "snippet": " cv.Set( ker_90, -1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L290_C4", "label": "Set()", "type": "expression", "loc": [290, 290], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.6459, 0.0022, 1, 0.59, 0.439, 438, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Set", "arg_names": [], "import_names": [], "rhs_call_name": "Set", "annotation": ""}, "snippet": " cv.Set( ker_90[:, 1], 2 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L291_C4", "label": "Filter2D()", "type": "expression", "loc": [291, 291], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.6481, 0.0022, 1, 0.59, 0.4634, 542, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "Filter2D", "arg_names": [], "import_names": [], "rhs_call_name": "Filter2D", "annotation": ""}, "snippet": " cv.Filter2D( image, result_90, ker_90 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L294_C4", "label": "ker_135 = CreateMat()", "type": "assigned_variable", "loc": [294, 294], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [14, 1, 0.6548, 0.0022, 1, 0.59, 0.4878, 227, 3, 3, 0, 0, 892, 10, 1], "semantic": {"name": "ker_135", "arg_names": [], "import_names": [], "rhs_call_name": "CreateMat", "annotation": ""}, "snippet": " ker_135 = cv.CreateMat( 3, 3, cv.CV_8S )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L295_C4", "label": "Set()", "type": "expression", "loc": [295, 295], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.657, 0.0022, 1, 0.59, 0.5122, 438, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Set", "arg_names": [], "import_names": [], "rhs_call_name": "Set", "annotation": ""}, "snippet": " cv.Set( ker_135, -1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L296_C4", "label": "assign", "type": "assigned_variable", "loc": [296, 296], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [14, 1, 0.6592, 0.0022, 1, 0.59, 0.5366, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ker_135[2, 0] = ker_135[1, 1] = ker_135[0, 2] = 2;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L297_C4", "label": "Filter2D()", "type": "expression", "loc": [297, 297], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.6615, 0.0022, 1, 0.59, 0.561, 542, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "Filter2D", "arg_names": [], "import_names": [], "rhs_call_name": "Filter2D", "annotation": ""}, "snippet": " cv.Filter2D( image, result_135, ker_135 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L300_C4", "label": "density = CreateImage()", "type": "assigned_variable", "loc": [300, 300], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [14, 1, 0.6682, 0.0022, 1, 0.59, 0.5854, 830, 3, 3, 0, 0, 288, 10, 2], "semantic": {"name": "density", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " density = cv.CreateImage( cv.GetSize( image ), image.depth, 1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L301_C4", "label": "temp = CreateImage()", "type": "assigned_variable", "loc": [301, 301], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [14, 1, 0.6704, 0.0022, 1, 0.59, 0.6098, 915, 3, 3, 0, 0, 288, 10, 2], "semantic": {"name": "temp", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " temp = cv.CreateImage( cv.GetSize( image ), image.depth, 1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L302_C4", "label": "AddWeighted()", "type": "expression", "loc": [302, 302], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.6726, 0.0022, 1, 0.59, 0.6341, 923, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "AddWeighted", "arg_names": [], "import_names": [], "rhs_call_name": "AddWeighted", "annotation": ""}, "snippet": " cv.AddWeighted( result_0, 0.5, result_90, 0.5, 0, density )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L303_C4", "label": "AddWeighted()", "type": "expression", "loc": [303, 303], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.6748, 0.0022, 1, 0.59, 0.6585, 923, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "AddWeighted", "arg_names": [], "import_names": [], "rhs_call_name": "AddWeighted", "annotation": ""}, "snippet": " cv.AddWeighted( result_45, 0.5, result_135, 0.5, 0, temp )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L304_C4", "label": "AddWeighted()", "type": "expression", "loc": [304, 304], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.6771, 0.0022, 1, 0.59, 0.6829, 923, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "AddWeighted", "arg_names": [], "import_names": [], "rhs_call_name": "AddWeighted", "annotation": ""}, "snippet": " cv.AddWeighted( temp, 0.5, density, 0.5, 0, density )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L307_C4", "label": "density = gaussian_blur_icl()", "type": "assigned_variable", "loc": [307, 307], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [14, 1, 0.6837, 0.0022, 1, 0.59, 0.7073, 830, 3, 3, 0, 0, 207, 10, 1], "semantic": {"name": "density", "arg_names": [], "import_names": [], "rhs_call_name": "gaussian_blur_icl", "annotation": ""}, "snippet": " density = gaussian_blur_icl( density, ( 3, 3 ), radius )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L312_C4", "label": "orients = CreateImage()", "type": "assigned_variable", "loc": [312, 312], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [14, 1, 0.6949, 0.0022, 1, 0.59, 0.7317, 129, 3, 3, 0, 0, 288, 10, 2], "semantic": {"name": "orients", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " orients = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L314_C4", "label": "Threshold()", "type": "expression", "loc": [314, 314], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.6993, 0.0022, 1, 0.59, 0.7561, 302, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "Threshold", "arg_names": [], "import_names": [], "rhs_call_name": "Threshold", "annotation": ""}, "snippet": " cv.Threshold( result_0, result_0, 128, 255, 0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L315_C4", "label": "Threshold()", "type": "expression", "loc": [315, 315], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.7016, 0.0022, 1, 0.59, 0.7805, 302, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "Threshold", "arg_names": [], "import_names": [], "rhs_call_name": "Threshold", "annotation": ""}, "snippet": " cv.Threshold( result_45, result_45, 128, 255, 0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L316_C4", "label": "Threshold()", "type": "expression", "loc": [316, 316], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.7038, 0.0022, 1, 0.59, 0.8049, 302, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "Threshold", "arg_names": [], "import_names": [], "rhs_call_name": "Threshold", "annotation": ""}, "snippet": " cv.Threshold( result_90, result_90, 128, 255, 0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L317_C4", "label": "Threshold()", "type": "expression", "loc": [317, 317], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.706, 0.0022, 1, 0.59, 0.8293, 302, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "Threshold", "arg_names": [], "import_names": [], "rhs_call_name": "Threshold", "annotation": ""}, "snippet": " cv.Threshold( result_135, result_135, 128, 255, 0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L319_C4", "label": "AddWeighted()", "type": "expression", "loc": [319, 319], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.7105, 0.0022, 1, 0.59, 0.8537, 923, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "AddWeighted", "arg_names": [], "import_names": [], "rhs_call_name": "AddWeighted", "annotation": ""}, "snippet": " cv.AddWeighted( result_0, 0.5, result_45, 0.5, 0, result_0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L320_C4", "label": "AddWeighted()", "type": "expression", "loc": [320, 320], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.7127, 0.0022, 1, 0.59, 0.878, 923, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "AddWeighted", "arg_names": [], "import_names": [], "rhs_call_name": "AddWeighted", "annotation": ""}, "snippet": " cv.AddWeighted( result_90, 0.5, result_135, 0.5, 0, result_90 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L321_C4", "label": "AddWeighted()", "type": "expression", "loc": [321, 321], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.7149, 0.0022, 1, 0.59, 0.9024, 923, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "AddWeighted", "arg_names": [], "import_names": [], "rhs_call_name": "AddWeighted", "annotation": ""}, "snippet": " cv.AddWeighted( result_90, 0.5, result_0, 0.5, 0, orients )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L324_C4", "label": "EqualizeHist()", "type": "expression", "loc": [324, 324], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.7216, 0.0022, 1, 0.59, 0.9268, 782, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "EqualizeHist", "arg_names": [], "import_names": [], "rhs_call_name": "EqualizeHist", "annotation": ""}, "snippet": " cv.EqualizeHist( orients, orients )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L329_C4", "label": "for x", "type": "for", "loc": [329, 331], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [6, 1, 0.735, 0.0067, 1, 0.59, 0.9512, 190, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in range( 0, density.width ):\n for y in range( 0, density.height ):\n density[y, x] *= orients[y, x] * laplac[y, x] / ( 255.0 * 255.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L330_C8", "label": "for y", "type": "for", "loc": [330, 331], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L329_C4", "vector": [6, 2, 0.7361, 0.0045, 2, 0.19, 0.0, 304, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for y in range( 0, density.height ):\n density[y, x] *= orients[y, x] * laplac[y, x] / ( 255.0 * 255.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L333_C4", "label": "EqualizeHist()", "type": "expression", "loc": [333, 333], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [8, 1, 0.7416, 0.0022, 1, 0.59, 0.9756, 782, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "EqualizeHist", "arg_names": [], "import_names": [], "rhs_call_name": "EqualizeHist", "annotation": ""}, "snippet": " cv.EqualizeHist( density, density )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L334_C4", "label": "return", "type": "return", "loc": [334, 334], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "vector": [13, 1, 0.7439, 0.0022, 1, 0.59, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return density"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L337_C0", "label": "gaussian_blur_icl", "type": "function", "loc": [337, 344], "level": 0, "parent": null, "vector": [2, 0, 0.7584, 0.0178, 0, 0.66, 0.7429, 207, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "gaussian_blur_icl", "arg_names": ["image", "ksize", "sigmaX"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def gaussian_blur_icl( image, ksize, sigmaX ):\n a = ksize[0]\n b = ksize[1]\n if a % 2 == 0:\n a += 1;\n if b % 2 == 0:\n b += 1\n return array2cv( cv2.GaussianBlur( cv2array( image ), ( a, b ), sigmaX ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L338_C4", "label": "a =", "type": "assigned_variable", "loc": [338, 338], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L337_C0", "vector": [14, 1, 0.7528, 0.0022, 1, 0.68, 0.0, 475, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " a = ksize[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L339_C4", "label": "b =", "type": "assigned_variable", "loc": [339, 339], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L337_C0", "vector": [14, 1, 0.755, 0.0022, 1, 0.68, 0.25, 756, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " b = ksize[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L340_C4", "label": "if", "type": "if", "loc": [340, 341], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L337_C0", "vector": [4, 1, 0.7584, 0.0045, 1, 0.68, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if a % 2 == 0:\n a += 1;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L342_C4", "label": "if", "type": "if", "loc": [342, 343], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L337_C0", "vector": [4, 1, 0.7628, 0.0045, 1, 0.68, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if b % 2 == 0:\n b += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L344_C4", "label": "return", "type": "return", "loc": [344, 344], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L337_C0", "vector": [13, 1, 0.7661, 0.0022, 1, 0.68, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return array2cv( cv2.GaussianBlur( cv2array( image ), ( a, b ), sigmaX ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L346_C0", "label": "average_pixels", "type": "function", "loc": [346, 350], "level": 0, "parent": null, "vector": [2, 0, 0.7751, 0.0111, 0, 0.66, 0.7714, 349, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "average_pixels", "arg_names": ["image", "dims"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def average_pixels( image, dims ):\n kernel = cv.CreateMat( dims[0], dims[1], cv.CV_32F )\n cv.Set( kernel, 1.0 / ( dims[0] * dims[1] ) )\n cv.Filter2D( image, image, kernel )\n return image"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L347_C4", "label": "kernel = CreateMat()", "type": "assigned_variable", "loc": [347, 347], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L346_C0", "vector": [14, 1, 0.7728, 0.0022, 1, 0.27, 0.0, 688, 3, 3, 0, 0, 892, 10, 1], "semantic": {"name": "kernel", "arg_names": [], "import_names": [], "rhs_call_name": "CreateMat", "annotation": ""}, "snippet": " kernel = cv.CreateMat( dims[0], dims[1], cv.CV_32F )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L348_C4", "label": "Set()", "type": "expression", "loc": [348, 348], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L346_C0", "vector": [8, 1, 0.7751, 0.0022, 1, 0.27, 0.3333, 438, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Set", "arg_names": [], "import_names": [], "rhs_call_name": "Set", "annotation": ""}, "snippet": " cv.Set( kernel, 1.0 / ( dims[0] * dims[1] ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L349_C4", "label": "Filter2D()", "type": "expression", "loc": [349, 349], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L346_C0", "vector": [8, 1, 0.7773, 0.0022, 1, 0.27, 0.6667, 542, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "Filter2D", "arg_names": [], "import_names": [], "rhs_call_name": "Filter2D", "annotation": ""}, "snippet": " cv.Filter2D( image, image, kernel )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L350_C4", "label": "return", "type": "return", "loc": [350, 350], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L346_C0", "vector": [13, 1, 0.7795, 0.0022, 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 image"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L352_C0", "label": "laplacian", "type": "function", "loc": [352, 359], "level": 0, "parent": null, "vector": [2, 0, 0.7918, 0.0178, 0, 0.66, 0.8, 429, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "laplacian", "arg_names": ["image"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def laplacian( image ):\n dst = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )\n kernel = cv.CreateMat( 3, 3, cv.CV_32F )\n cv.Set( kernel, 1 )\n kernel[0, 1] = kernel[1, 0] = kernel[2, 1] = kernel[1, 2] = 2\n kernel[1, 1] = -12\n cv.Filter2D( image, dst, kernel )\n return dst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L353_C4", "label": "dst = CreateImage()", "type": "assigned_variable", "loc": [353, 353], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L352_C0", "vector": [14, 1, 0.7862, 0.0022, 1, 0.9, 0.0, 856, 3, 3, 0, 0, 288, 10, 2], "semantic": {"name": "dst", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " dst = cv.CreateImage( cv.GetSize( image ), image.depth, image.nChannels )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L354_C4", "label": "kernel = CreateMat()", "type": "assigned_variable", "loc": [354, 354], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L352_C0", "vector": [14, 1, 0.7884, 0.0022, 1, 0.9, 0.1667, 688, 3, 3, 0, 0, 892, 10, 1], "semantic": {"name": "kernel", "arg_names": [], "import_names": [], "rhs_call_name": "CreateMat", "annotation": ""}, "snippet": " kernel = cv.CreateMat( 3, 3, cv.CV_32F )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L355_C4", "label": "Set()", "type": "expression", "loc": [355, 355], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L352_C0", "vector": [8, 1, 0.7906, 0.0022, 1, 0.9, 0.3333, 438, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Set", "arg_names": [], "import_names": [], "rhs_call_name": "Set", "annotation": ""}, "snippet": " cv.Set( kernel, 1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L356_C4", "label": "assign", "type": "assigned_variable", "loc": [356, 356], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L352_C0", "vector": [14, 1, 0.7929, 0.0022, 1, 0.9, 0.5, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kernel[0, 1] = kernel[1, 0] = kernel[2, 1] = kernel[1, 2] = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L357_C4", "label": "assign", "type": "assigned_variable", "loc": [357, 357], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L352_C0", "vector": [14, 1, 0.7951, 0.0022, 1, 0.9, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kernel[1, 1] = -12"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L358_C4", "label": "Filter2D()", "type": "expression", "loc": [358, 358], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L352_C0", "vector": [8, 1, 0.7973, 0.0022, 1, 0.9, 0.8333, 542, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "Filter2D", "arg_names": [], "import_names": [], "rhs_call_name": "Filter2D", "annotation": ""}, "snippet": " cv.Filter2D( image, dst, kernel )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L359_C4", "label": "return", "type": "return", "loc": [359, 359], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L352_C0", "vector": [13, 1, 0.7996, 0.0022, 1, 0.9, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L362_C0", "label": "cv2array", "type": "function", "loc": [362, 379], "level": 0, "parent": null, "vector": [2, 0, 0.8252, 0.0401, 0, 0.66, 0.8286, 771, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "cv2array", "arg_names": ["im"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def cv2array( im ):\n depth2dtype = {\n cv.IPL_DEPTH_8U: 'uint8',\n cv.IPL_DEPTH_8S: 'int8',\n cv.IPL_DEPTH_16U: 'uint16',\n cv.IPL_DEPTH_16S: 'int16',\n cv.IPL_DEPTH_32S: 'int32',\n cv.IPL_DEPTH_32F: 'float32',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L363_C2", "label": "depth2dtype =", "type": "assigned_variable", "loc": [363, 371], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L362_C0", "vector": [14, 1, 0.8174, 0.02, 1, 0.07, 0.0, 326, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "depth2dtype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " depth2dtype = {\n cv.IPL_DEPTH_8U: 'uint8',\n cv.IPL_DEPTH_8S: 'int8',\n cv.IPL_DEPTH_16U: 'uint16',\n cv.IPL_DEPTH_16S: 'int16',\n cv.IPL_DEPTH_32S: 'int32',\n cv.IPL_DEPTH_32F: 'float32',\n cv.IPL_DEPTH_64F: 'float64',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L373_C2", "label": "arrdtype =", "type": "assigned_variable", "loc": [373, 373], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L362_C0", "vector": [14, 1, 0.8307, 0.0022, 1, 0.07, 0.25, 927, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "arrdtype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " arrdtype = im.depth"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L374_C2", "label": "a = fromstring()", "type": "assigned_variable", "loc": [374, 377], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L362_C0", "vector": [14, 1, 0.8363, 0.0089, 1, 0.07, 0.5, 475, 3, 3, 0, 0, 551, 10, 2], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "fromstring", "annotation": ""}, "snippet": " a = np.fromstring( \n im.tostring(),\n dtype=depth2dtype[im.depth],\n count=im.width * im.height * im.nChannels )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L378_C2", "label": "a.shape =", "type": "assigned_variable", "loc": [378, 378], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L362_C0", "vector": [14, 1, 0.8419, 0.0022, 1, 0.07, 0.75, 206, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "a.shape", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " a.shape = ( im.height, im.width, im.nChannels )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L379_C2", "label": "return", "type": "return", "loc": [379, 379], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L362_C0", "vector": [13, 1, 0.8441, 0.0022, 1, 0.07, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L383_C0", "label": "array2cv", "type": "function", "loc": [383, 402], "level": 0, "parent": null, "vector": [2, 0, 0.8742, 0.0445, 0, 0.66, 0.8571, 769, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "array2cv", "arg_names": ["a"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def array2cv( a ):\n dtype2depth = {\n 'uint8': cv.IPL_DEPTH_8U,\n 'int8': cv.IPL_DEPTH_8S,\n 'uint16': cv.IPL_DEPTH_16U,\n 'int16': cv.IPL_DEPTH_16S,\n 'int32': cv.IPL_DEPTH_32S,\n 'float32': cv.IPL_DEPTH_32F,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L384_C2", "label": "dtype2depth =", "type": "assigned_variable", "loc": [384, 392], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L383_C0", "vector": [14, 1, 0.8641, 0.02, 1, 0.96, 0.0, 154, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "dtype2depth", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dtype2depth = {\n 'uint8': cv.IPL_DEPTH_8U,\n 'int8': cv.IPL_DEPTH_8S,\n 'uint16': cv.IPL_DEPTH_16U,\n 'int16': cv.IPL_DEPTH_16S,\n 'int32': cv.IPL_DEPTH_32S,\n 'float32': cv.IPL_DEPTH_32F,\n 'float64': cv.IPL_DEPTH_64F,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Try_L393_C2", "label": "try", "type": "try", "loc": [393, 396], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L383_C0", "vector": [7, 1, 0.8786, 0.0089, 1, 0.96, 0.25, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n nChannels = a.shape[2]\n except:\n nChannels = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L394_C4", "label": "nChannels =", "type": "assigned_variable", "loc": [394, 394], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:Try_L393_C2", "vector": [14, 2, 0.8775, 0.0022, 2, 0.82, 0.0, 808, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "nChannels", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nChannels = a.shape[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L396_C4", "label": "nChannels =", "type": "assigned_variable", "loc": [396, 396], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:Try_L393_C2", "vector": [14, 2, 0.882, 0.0022, 2, 0.82, 0.0, 808, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "nChannels", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nChannels = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L397_C2", "label": "cv_im = CreateImageHeader()", "type": "assigned_variable", "loc": [397, 399], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L383_C0", "vector": [14, 1, 0.8864, 0.0067, 1, 0.96, 0.5, 782, 3, 3, 0, 0, 564, 10, 2], "semantic": {"name": "cv_im", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImageHeader", "annotation": ""}, "snippet": " cv_im = cv.CreateImageHeader( ( a.shape[1], a.shape[0] ),\n dtype2depth[str( a.dtype )],\n nChannels )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L400_C2", "label": "SetData()", "type": "expression", "loc": [400, 401], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L383_C0", "vector": [8, 1, 0.892, 0.0045, 1, 0.96, 0.75, 617, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "SetData", "arg_names": [], "import_names": [], "rhs_call_name": "SetData", "annotation": ""}, "snippet": " cv.SetData( cv_im, a.tostring(),\n a.dtype.itemsize * nChannels * a.shape[1] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L402_C2", "label": "return", "type": "return", "loc": [402, 402], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L383_C0", "vector": [13, 1, 0.8953, 0.0022, 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 cv_im"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L404_C0", "label": "sum_orients", "type": "function", "loc": [404, 410], "level": 0, "parent": null, "vector": [2, 0, 0.9065, 0.0156, 0, 0.66, 0.8857, 594, 0, 5, 1, 0, 0, 0, 6], "semantic": {"name": "sum_orients", "arg_names": ["img", "x", "y", "median_radius", "threshold"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def sum_orients( img, x, y, median_radius, threshold=255 ):\n sum = 0\n for curx in range( max( x - median_radius, 0 ), min( x + median_radius, img.width ) ):\n for cury in range( max( y - median_radius, 0 ), min( y + median_radius, img.height ) ):\n if( img[cury, curx] >= threshold ):\n sum += 1\n return sum"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L405_C4", "label": "sum =", "type": "assigned_variable", "loc": [405, 405], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L404_C0", "vector": [14, 1, 0.902, 0.0022, 1, 0.38, 0.0, 824, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "sum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sum = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L406_C4", "label": "for curx", "type": "for", "loc": [406, 409], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L404_C0", "vector": [6, 1, 0.9076, 0.0089, 1, 0.38, 0.5, 281, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "curx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for curx in range( max( x - median_radius, 0 ), min( x + median_radius, img.width ) ):\n for cury in range( max( y - median_radius, 0 ), min( y + median_radius, img.height ) ):\n if( img[cury, curx] >= threshold ):\n sum += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L407_C8", "label": "for cury", "type": "for", "loc": [407, 409], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L406_C4", "vector": [6, 2, 0.9087, 0.0067, 2, 0.11, 0.0, 119, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "cury", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for cury in range( max( y - median_radius, 0 ), min( y + median_radius, img.height ) ):\n if( img[cury, curx] >= threshold ):\n sum += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L408_C12", "label": "if", "type": "if", "loc": [408, 409], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L407_C8", "vector": [4, 3, 0.9098, 0.0045, 3, 0.8, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if( img[cury, curx] >= threshold ):\n sum += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L410_C4", "label": "return", "type": "return", "loc": [410, 410], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L404_C0", "vector": [13, 1, 0.9131, 0.0022, 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 sum"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L413_C0", "label": "show", "type": "function", "loc": [413, 416], "level": 0, "parent": null, "vector": [2, 0, 0.9232, 0.0089, 0, 0.66, 0.9143, 497, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "show", "arg_names": ["picture", "desc"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def show( picture, desc=\"no_desc\" ):\n return\n cv.ShowImage( desc, picture )\n cv.WaitKey()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L414_C4", "label": "return", "type": "return", "loc": [414, 414], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L413_C0", "vector": [13, 1, 0.922, 0.0022, 1, 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_1400:Expr_L415_C4", "label": "ShowImage()", "type": "expression", "loc": [415, 415], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L413_C0", "vector": [8, 1, 0.9243, 0.0022, 1, 0.88, 0.5, 896, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "ShowImage", "arg_names": [], "import_names": [], "rhs_call_name": "ShowImage", "annotation": ""}, "snippet": " cv.ShowImage( desc, picture )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L416_C4", "label": "WaitKey()", "type": "expression", "loc": [416, 416], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L413_C0", "vector": [8, 1, 0.9265, 0.0022, 1, 0.88, 1.0, 885, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "WaitKey", "arg_names": [], "import_names": [], "rhs_call_name": "WaitKey", "annotation": ""}, "snippet": " cv.WaitKey()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L418_C0", "label": "show_wait", "type": "function", "loc": [418, 420], "level": 0, "parent": null, "vector": [2, 0, 0.9332, 0.0067, 0, 0.66, 0.9429, 33, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "show_wait", "arg_names": ["picture", "desc"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def show_wait( picture, desc=\"no_desc\" ):\n cv.ShowImage( desc, picture )\n cv.WaitKey()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L419_C4", "label": "ShowImage()", "type": "expression", "loc": [419, 419], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L418_C0", "vector": [8, 1, 0.9332, 0.0022, 1, 0.43, 0.0, 896, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "ShowImage", "arg_names": [], "import_names": [], "rhs_call_name": "ShowImage", "annotation": ""}, "snippet": " cv.ShowImage( desc, picture )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L420_C4", "label": "WaitKey()", "type": "expression", "loc": [420, 420], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L418_C0", "vector": [8, 1, 0.9354, 0.0022, 1, 0.43, 1.0, 885, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "WaitKey", "arg_names": [], "import_names": [], "rhs_call_name": "WaitKey", "annotation": ""}, "snippet": " cv.WaitKey()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L422_C0", "label": "sum_array", "type": "function", "loc": [422, 423], "level": 0, "parent": null, "vector": [2, 0, 0.941, 0.0045, 0, 0.66, 0.9714, 592, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "sum_array", "arg_names": ["array"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def sum_array( array ):\n return sum( np.asarray( array ).reshape( -1 ).tolist() )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L423_C4", "label": "return", "type": "return", "loc": [423, 423], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L422_C0", "vector": [13, 1, 0.9421, 0.0022, 1, 0.63, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sum( np.asarray( array ).reshape( -1 ).tolist() )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L425_C0", "label": "find_density_maximum", "type": "function", "loc": [425, 447], "level": 0, "parent": null, "vector": [2, 0, 0.971, 0.0512, 0, 0.66, 1.0, 134, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "find_density_maximum", "arg_names": ["image"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def find_density_maximum( image ):\n i = [0, 0, image.width, image.height]\n \n max_copy = i\n max_density = 0\n while True:\n # print \"current density: \" + str( max_density )\n for ind in range( 0, 4 ):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L426_C4", "label": "i =", "type": "assigned_variable", "loc": [426, 426], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L425_C0", "vector": [14, 1, 0.9488, 0.0022, 1, 0.68, 0.0, 826, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i = [0, 0, image.width, image.height]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L428_C4", "label": "max_copy =", "type": "assigned_variable", "loc": [428, 428], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L425_C0", "vector": [14, 1, 0.9532, 0.0022, 1, 0.68, 0.25, 426, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "max_copy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_copy = i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L429_C4", "label": "max_density =", "type": "assigned_variable", "loc": [429, 429], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L425_C0", "vector": [14, 1, 0.9555, 0.0022, 1, 0.68, 0.5, 575, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "max_density", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_density = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L430_C4", "label": "while", "type": "while", "loc": [430, 446], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L425_C0", "vector": [5, 1, 0.9755, 0.0379, 1, 0.68, 0.75, 0, 1, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n # print \"current density: \" + str( max_density )\n for ind in range( 0, 4 ):\n copy = list( i )\n if ind > 1:\n copy[ind] -= 1\n else:\n copy[ind] += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L432_C8", "label": "for ind", "type": "for", "loc": [432, 442], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L430_C4", "vector": [6, 2, 0.9733, 0.0245, 2, 0.55, 0.0, 680, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "ind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ind in range( 0, 4 ):\n copy = list( i )\n if ind > 1:\n copy[ind] -= 1\n else:\n copy[ind] += 1\n density = sum_array( image[copy[1] : copy[3], copy[0] : copy[2]] ) ** 2 * 1.0 / ( ( copy[3] - copy[1] ) * ( copy[2] - copy[0] ) ) ** 2\n # print \"candidate_density: \" + str( density )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L433_C12", "label": "copy = list()", "type": "assigned_variable", "loc": [433, 433], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L432_C8", "vector": [14, 3, 0.9644, 0.0022, 3, 0.31, 0.0, 739, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "copy", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " copy = list( i )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L434_C12", "label": "if", "type": "if", "loc": [434, 437], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L432_C8", "vector": [4, 3, 0.9699, 0.0089, 3, 0.31, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ind > 1:\n copy[ind] -= 1\n else:\n copy[ind] += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L438_C12", "label": "density =", "type": "assigned_variable", "loc": [438, 438], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L432_C8", "vector": [14, 3, 0.9755, 0.0022, 3, 0.31, 0.6667, 830, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "density", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " density = sum_array( image[copy[1] : copy[3], copy[0] : copy[2]] ) ** 2 * 1.0 / ( ( copy[3] - copy[1] ) * ( copy[2] - copy[0] ) ) ** 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L440_C12", "label": "if", "type": "if", "loc": [440, 442], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L432_C8", "vector": [4, 3, 0.9822, 0.0067, 3, 0.31, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if density > max_density:\n max_density = density\n max_copy = copy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L441_C16", "label": "max_density =", "type": "assigned_variable", "loc": [441, 441], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L440_C12", "vector": [14, 4, 0.9822, 0.0022, 4, 0.03, 0.0, 575, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "max_density", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_density = density"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L442_C16", "label": "max_copy =", "type": "assigned_variable", "loc": [442, 442], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L440_C12", "vector": [14, 4, 0.9844, 0.0022, 4, 0.03, 1.0, 426, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "max_copy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_copy = copy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L443_C8", "label": "if", "type": "if", "loc": [443, 446], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L430_C4", "vector": [4, 2, 0.99, 0.0089, 2, 0.55, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i == max_copy:\n break\n else:\n i = max_copy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L446_C12", "label": "i =", "type": "assigned_variable", "loc": [446, 446], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L443_C8", "vector": [14, 3, 0.9933, 0.0022, 3, 0.5, 0.0, 826, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i = max_copy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L447_C4", "label": "return", "type": "return", "loc": [447, 447], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L425_C0", "vector": [13, 1, 0.9955, 0.0022, 1, 0.68, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return max_copy"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L12_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L13_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L51_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L52_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L73_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L75_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L76_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L86_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L87_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L87_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L88_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L87_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L89_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L89_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L90_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L90_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L91_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L122_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L134_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L134_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L134_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L134_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L134_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L134_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L134_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L147_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L148_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L149_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L149_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L150_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L149_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L151_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L151_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L152_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L149_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L154_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L154_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L155_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L160_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L160_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L160_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L165_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L167_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L165_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L168_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L165_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L169_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L165_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L170_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L170_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L171_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L170_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L172_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L160_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L160_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L187_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L196_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L199_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L200_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L201_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L202_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L201_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L203_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L203_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L204_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L203_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L205_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L203_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L206_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L203_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L207_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L203_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L208_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L203_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L210_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L211_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L212_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L213_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L214_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L215_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L217_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L218_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L219_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L220_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L209_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L221_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L201_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L223_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L229_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L230_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L229_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L232_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L232_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L233_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L233_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L234_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L229_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L235_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L229_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L236_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L229_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L239_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L240_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L241_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L229_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L242_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L244_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L244_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L246_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L253_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L244_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L254_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L259_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L263_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L264_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L266_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L267_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L271_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L272_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L273_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L276_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L277_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L278_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L279_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L282_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L283_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L284_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L285_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L288_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L289_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L290_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L291_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L294_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L296_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L297_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L300_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L301_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L303_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L304_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L307_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L312_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L314_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L315_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L316_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L317_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L319_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L320_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L321_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L324_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L329_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L329_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L330_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L333_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L337_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L338_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L337_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L339_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L337_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L340_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L337_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L342_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L337_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L344_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L346_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L347_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L346_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L348_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L346_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L349_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L346_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L350_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L352_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L353_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L352_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L354_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L352_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L355_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L352_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L356_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L352_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L357_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L352_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L358_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L352_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L359_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L362_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L363_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L362_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L373_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L362_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L374_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L362_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L378_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L362_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L379_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L383_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L384_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L383_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Try_L393_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:Try_L393_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L394_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:Try_L393_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L396_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L383_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L397_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L383_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L400_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L383_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L402_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L404_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L405_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L404_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L406_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L406_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L407_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L407_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L408_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L404_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L410_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L413_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L414_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L413_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L415_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L413_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L416_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L418_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L419_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L418_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Expr_L420_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L422_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L423_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L425_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L426_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L425_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L428_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L425_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L429_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L425_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L430_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L430_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L432_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L432_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L433_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L432_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L434_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L432_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L438_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:For_L432_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L440_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L440_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L441_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L440_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L442_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:While_L430_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L443_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:If_L443_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Assign_L446_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1400:FunctionDef_L425_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1400:Return_L447_C4"}] |
import tesseract
import sys
api = tesseract.TessBaseAPI()
api.Init(".","eng",tesseract.OEM_DEFAULT)
api.SetVariable("tessedit_char_whitelist", "0123456789\.\:")
api.SetPageSegMode(tesseract.PSM_AUTO)
mImgFile = sys.argv[1]
mBuffer=open(mImgFile,"rb").read()
result = tesseract.ProcessPagesBuffer(mBuffer,len(mBuffer),api)
print "result(ProcessPagesBuffer)=",result
| ajibawa-2023/Python-Code-Large/train/row_1401 | 10 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1401:Import_L1_C0", "label": "tesseract import tesseract", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 332, 0, 1, 0, 0, 332, 0, 0], "semantic": {"name": "tesseract", "arg_names": [], "import_names": ["tesseract"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tesseract"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1401:Import_L2_C0", "label": "sys import sys", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0833, 0, 0.66, 0.1111, 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_1401:Assign_L4_C0", "label": "api = TessBaseAPI()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.3333, 0.0833, 0, 0.66, 0.2222, 976, 3, 0, 0, 0, 49, 10, 1], "semantic": {"name": "api", "arg_names": [], "import_names": [], "rhs_call_name": "TessBaseAPI", "annotation": ""}, "snippet": "api = tesseract.TessBaseAPI()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1401:Expr_L5_C0", "label": "Init()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.4167, 0.0833, 0, 0.66, 0.3333, 44, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "Init", "arg_names": [], "import_names": [], "rhs_call_name": "Init", "annotation": ""}, "snippet": "api.Init(\".\",\"eng\",tesseract.OEM_DEFAULT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1401:Expr_L6_C0", "label": "SetVariable()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.5, 0.0833, 0, 0.66, 0.4444, 94, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "SetVariable", "arg_names": [], "import_names": [], "rhs_call_name": "SetVariable", "annotation": ""}, "snippet": "api.SetVariable(\"tessedit_char_whitelist\", \"0123456789\\.\\:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1401:Expr_L7_C0", "label": "SetPageSegMode()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.5833, 0.0833, 0, 0.66, 0.5556, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "SetPageSegMode", "arg_names": [], "import_names": [], "rhs_call_name": "SetPageSegMode", "annotation": ""}, "snippet": "api.SetPageSegMode(tesseract.PSM_AUTO)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1401:Assign_L9_C0", "label": "mImgFile =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.75, 0.0833, 0, 0.66, 0.6667, 252, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "mImgFile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "mImgFile = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1401:Assign_L10_C0", "label": "mBuffer = read()", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.8333, 0.0833, 0, 0.66, 0.7778, 145, 3, 0, 0, 0, 453, 10, 2], "semantic": {"name": "mBuffer", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": "mBuffer=open(mImgFile,\"rb\").read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1401:Assign_L11_C0", "label": "result = ProcessPagesBuffer()", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.9167, 0.0833, 0, 0.66, 0.8889, 51, 3, 3, 0, 0, 788, 10, 2], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "ProcessPagesBuffer", "annotation": ""}, "snippet": "result = tesseract.ProcessPagesBuffer(mBuffer,len(mBuffer),api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1401:Expr_L12_C0", "label": "print()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0833, 0, 0.66, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"result(ProcessPagesBuffer)=\",result)"}] | [] |
"""Utility functions for processing images for delivery to Tesseract"""
import os
def image_to_scratch(im, scratch_image_name):
"""Saves image in memory to scratch file. .bmp format will be read correctly by Tesseract"""
im.save(scratch_image_name, dpi=(200,200))
def retrieve_text(scratch_text_name_root):
inf = file(scratch_text_name_root + '.txt')
text = inf.read()
inf.close()
return text
def perform_cleanup(scratch_image_name, scratch_text_name_root):
"""Clean up temporary files from disk"""
for name in (scratch_image_name, scratch_text_name_root + '.txt', "tesseract.log"):
try:
os.remove(name)
except OSError:
pass
| ajibawa-2023/Python-Code-Large/train/row_1402 | 15 | 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_1402:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0476, 0.0476, 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 functions for processing images for delivery to Tesseract\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1402:Import_L3_C0", "label": "os import os", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0476, 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_1402:FunctionDef_L5_C0", "label": "image_to_scratch", "type": "function", "loc": [5, 7], "level": 0, "parent": null, "vector": [2, 0, 0.2857, 0.1429, 0, 0.66, 0.5, 580, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "image_to_scratch", "arg_names": ["im", "scratch_image_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def image_to_scratch(im, scratch_image_name):\n\t\"\"\"Saves image in memory to scratch file. .bmp format will be read correctly by Tesseract\"\"\"\n\tim.save(scratch_image_name, dpi=(200,200))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1402:Expr_L6_C1", "label": "expression", "type": "expression", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1402:FunctionDef_L5_C0", "vector": [8, 1, 0.2857, 0.0476, 1, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\"\"\"Saves image in memory to scratch file. .bmp format will be read correctly by Tesseract\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1402:Expr_L7_C1", "label": "save()", "type": "expression", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1402:FunctionDef_L5_C0", "vector": [8, 1, 0.3333, 0.0476, 1, 0.19, 1.0, 928, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": "\tim.save(scratch_image_name, dpi=(200,200))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1402:FunctionDef_L9_C0", "label": "retrieve_text", "type": "function", "loc": [9, 13], "level": 0, "parent": null, "vector": [2, 0, 0.5238, 0.2381, 0, 0.66, 0.75, 306, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "retrieve_text", "arg_names": ["scratch_text_name_root"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def\tretrieve_text(scratch_text_name_root):\n\tinf = file(scratch_text_name_root + '.txt')\n\ttext = inf.read()\n\tinf.close()\n\treturn text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1402:Assign_L10_C1", "label": "inf = file()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1402:FunctionDef_L9_C0", "vector": [14, 1, 0.4762, 0.0476, 1, 0.03, 0.0, 716, 3, 1, 0, 0, 107, 10, 1], "semantic": {"name": "inf", "arg_names": [], "import_names": [], "rhs_call_name": "file", "annotation": ""}, "snippet": "\tinf = file(scratch_text_name_root + '.txt')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1402:Assign_L11_C1", "label": "text = read()", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1402:FunctionDef_L9_C0", "vector": [14, 1, 0.5238, 0.0476, 1, 0.03, 0.3333, 439, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": "\ttext = inf.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1402:Expr_L12_C1", "label": "close()", "type": "expression", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1402:FunctionDef_L9_C0", "vector": [8, 1, 0.5714, 0.0476, 1, 0.03, 0.6667, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\tinf.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1402:Return_L13_C1", "label": "return", "type": "return", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1402:FunctionDef_L9_C0", "vector": [13, 1, 0.619, 0.0476, 1, 0.03, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1402:FunctionDef_L15_C0", "label": "perform_cleanup", "type": "function", "loc": [15, 21], "level": 0, "parent": null, "vector": [2, 0, 0.8571, 0.3333, 0, 0.66, 1.0, 759, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "perform_cleanup", "arg_names": ["scratch_image_name", "scratch_text_name_root"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def perform_cleanup(scratch_image_name, scratch_text_name_root):\n\t\"\"\"Clean up temporary files from disk\"\"\"\n\tfor name in (scratch_image_name, scratch_text_name_root + '.txt', \"tesseract.log\"):\n\t\ttry:\n\t\t\tos.remove(name)\n\t\texcept OSError:\n\t\t\tpass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1402:Expr_L16_C1", "label": "expression", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1402:FunctionDef_L15_C0", "vector": [8, 1, 0.7619, 0.0476, 1, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\"\"\"Clean up temporary files from disk\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1402:For_L17_C1", "label": "for name", "type": "for", "loc": [17, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1402:FunctionDef_L15_C0", "vector": [6, 1, 0.9048, 0.2381, 1, 0.84, 1.0, 57, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor name in (scratch_image_name, scratch_text_name_root + '.txt', \"tesseract.log\"):\n\t\ttry:\n\t\t\tos.remove(name)\n\t\texcept OSError:\n\t\t\tpass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1402:Try_L18_C2", "label": "try", "type": "try", "loc": [18, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1402:For_L17_C1", "vector": [7, 2, 0.9286, 0.1905, 2, 0.33, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ttry:\n\t\t\tos.remove(name)\n\t\texcept OSError:\n\t\t\tpass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1402:Expr_L19_C3", "label": "remove()", "type": "expression", "loc": [19, 19], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1402:Try_L18_C2", "vector": [8, 3, 0.9048, 0.0476, 3, 0.1, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": "\t\t\tos.remove(name)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1402:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1402:Expr_L6_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1402:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1402:Expr_L7_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1402:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1402:Assign_L10_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1402:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1402:Assign_L11_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1402:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1402:Expr_L12_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1402:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1402:Return_L13_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1402:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1402:Expr_L16_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1402:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1402:For_L17_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1402:For_L17_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1402:Try_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1402:Try_L18_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1402:Expr_L19_C3"}] |
import cv2
import numpy as np
img = cv2.imread('meat/551054_346968652052693_986626722_n.jpg')
h = np.zeros((300,256,3))
bins = np.arange(256).reshape(256,1)
color = [ (255,0,0),(0,255,0),(0,0,255) ]
for ch, col in enumerate(color):
hist_item = cv2.calcHist([img],[ch],None,[256],[0,255])
cv2.normalize(hist_item,hist_item,0,255,cv2.NORM_MINMAX)
hist=np.int32(np.around(hist_item))
pts = np.column_stack((bins,hist))
cv2.polylines(h,[pts],False,col)
h=np.flipud(h)
cv2.imshow('colorhist',h)
cv2.waitKey(0)
| ajibawa-2023/Python-Code-Large/train/row_1404 | 15 | 19 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1404:Import_L1_C0", "label": "cv2 import cv2", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 896, 0, 1, 0, 0, 896, 0, 0], "semantic": {"name": "cv2", "arg_names": [], "import_names": ["cv2"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cv2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1404:Import_L2_C0", "label": "numpy import np", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1053, 0.0526, 0, 0.66, 0.1111, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1404:Assign_L4_C0", "label": "img = imread()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.2105, 0.0526, 0, 0.66, 0.2222, 200, 3, 1, 0, 0, 540, 10, 1], "semantic": {"name": "img", "arg_names": [], "import_names": [], "rhs_call_name": "imread", "annotation": ""}, "snippet": "img = cv2.imread('meat/551054_346968652052693_986626722_n.jpg')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1404:Assign_L5_C0", "label": "h = zeros()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.2632, 0.0526, 0, 0.66, 0.3333, 686, 3, 1, 0, 0, 213, 10, 1], "semantic": {"name": "h", "arg_names": [], "import_names": [], "rhs_call_name": "zeros", "annotation": ""}, "snippet": "h = np.zeros((300,256,3))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1404:Assign_L7_C0", "label": "bins = reshape()", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.3684, 0.0526, 0, 0.66, 0.4444, 792, 3, 2, 0, 0, 276, 10, 2], "semantic": {"name": "bins", "arg_names": [], "import_names": [], "rhs_call_name": "reshape", "annotation": ""}, "snippet": "bins = np.arange(256).reshape(256,1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1404:Assign_L8_C0", "label": "color =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.4211, 0.0526, 0, 0.66, 0.5556, 776, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "color", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "color = [ (255,0,0),(0,255,0),(0,0,255) ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1404:For_L9_C0", "label": "for ch, col", "type": "for", "loc": [9, 14], "level": 0, "parent": null, "vector": [6, 0, 0.6053, 0.3158, 0, 0.66, 0.6667, 36, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "ch, col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for ch, col in enumerate(color):\n hist_item = cv2.calcHist([img],[ch],None,[256],[0,255])\n cv2.normalize(hist_item,hist_item,0,255,cv2.NORM_MINMAX)\n hist=np.int32(np.around(hist_item))\n pts = np.column_stack((bins,hist))\n cv2.polylines(h,[pts],False,col)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1404:Assign_L10_C4", "label": "hist_item = calcHist()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1404:For_L9_C0", "vector": [14, 1, 0.5263, 0.0526, 1, 0.92, 0.0, 424, 3, 5, 0, 0, 274, 10, 1], "semantic": {"name": "hist_item", "arg_names": [], "import_names": [], "rhs_call_name": "calcHist", "annotation": ""}, "snippet": " hist_item = cv2.calcHist([img],[ch],None,[256],[0,255])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1404:Expr_L11_C4", "label": "normalize()", "type": "expression", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1404:For_L9_C0", "vector": [8, 1, 0.5789, 0.0526, 1, 0.92, 0.25, 257, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "normalize", "arg_names": [], "import_names": [], "rhs_call_name": "normalize", "annotation": ""}, "snippet": " cv2.normalize(hist_item,hist_item,0,255,cv2.NORM_MINMAX)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1404:Assign_L12_C4", "label": "hist = int32()", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1404:For_L9_C0", "vector": [14, 1, 0.6316, 0.0526, 1, 0.92, 0.5, 353, 3, 1, 0, 0, 808, 10, 2], "semantic": {"name": "hist", "arg_names": [], "import_names": [], "rhs_call_name": "int32", "annotation": ""}, "snippet": " hist=np.int32(np.around(hist_item))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1404:Assign_L13_C4", "label": "pts = column_stack()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1404:For_L9_C0", "vector": [14, 1, 0.6842, 0.0526, 1, 0.92, 0.75, 195, 3, 1, 0, 0, 724, 10, 1], "semantic": {"name": "pts", "arg_names": [], "import_names": [], "rhs_call_name": "column_stack", "annotation": ""}, "snippet": " pts = np.column_stack((bins,hist))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1404:Expr_L14_C4", "label": "polylines()", "type": "expression", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1404:For_L9_C0", "vector": [8, 1, 0.7368, 0.0526, 1, 0.92, 1.0, 965, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "polylines", "arg_names": [], "import_names": [], "rhs_call_name": "polylines", "annotation": ""}, "snippet": " cv2.polylines(h,[pts],False,col)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1404:Assign_L16_C0", "label": "h = flipud()", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.8421, 0.0526, 0, 0.66, 0.7778, 686, 3, 1, 0, 0, 463, 10, 1], "semantic": {"name": "h", "arg_names": [], "import_names": [], "rhs_call_name": "flipud", "annotation": ""}, "snippet": "h=np.flipud(h)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1404:Expr_L18_C0", "label": "imshow()", "type": "expression", "loc": [18, 18], "level": 0, "parent": null, "vector": [8, 0, 0.9474, 0.0526, 0, 0.66, 0.8889, 851, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "imshow", "arg_names": [], "import_names": [], "rhs_call_name": "imshow", "annotation": ""}, "snippet": "cv2.imshow('colorhist',h)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1404:Expr_L19_C0", "label": "waitKey()", "type": "expression", "loc": [19, 19], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0526, 0, 0.66, 1.0, 514, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "waitKey", "arg_names": [], "import_names": [], "rhs_call_name": "waitKey", "annotation": ""}, "snippet": "cv2.waitKey(0)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1404:For_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1404:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1404:For_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1404:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1404:For_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1404:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1404:For_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1404:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1404:For_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1404:Expr_L14_C4"}] |
from PIL import Image
import ImageEnhance
from pytesser import *
from urllib import urlretrieve
import sys
im = Image.open(sys.argv[1])
nx, ny = im.size
im2 = im.resize((int(nx*5), int(ny*5)), Image.BICUBIC)
im2.save("temp2.png")
enh = ImageEnhance.Contrast(im)
enh.enhance(1.3).show("30% more contrast")
imgx = Image.open('temp2.png')
imgx = imgx.convert("RGBA")
pix = imgx.load()
for y in xrange(imgx.size[1]):
for x in xrange(imgx.size[0]):
if pix[x, y] != (0, 0, 0, 255):
pix[x, y] = (255, 255, 255, 255)
imgx.save("bw.gif", "GIF")
original = Image.open('bw.gif')
bg = original.resize((116, 56), Image.NEAREST)
ext = ".tif"
bg.save("input-NEAREST" + ext)
image = Image.open('input-NEAREST.tif')
print image_to_string(image)
| ajibawa-2023/Python-Code-Large/train/row_1405 | 25 | 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_1405:ImportFrom_L1_C0", "label": "from PIL import Image", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0357, 0.0357, 0, 0.66, 0.0, 556, 0, 1, 0, 0, 556, 0, 0], "semantic": {"name": "PIL", "arg_names": [], "import_names": ["Image"], "rhs_call_name": "", "annotation": ""}, "snippet": "from PIL import Image"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:Import_L2_C0", "label": "ImageEnhance import ImageEnhance", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0357, 0, 0.66, 0.0476, 573, 0, 1, 0, 0, 573, 0, 0], "semantic": {"name": "ImageEnhance", "arg_names": [], "import_names": ["ImageEnhance"], "rhs_call_name": "", "annotation": ""}, "snippet": "import ImageEnhance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:ImportFrom_L3_C0", "label": "from pytesser import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1071, 0.0357, 0, 0.66, 0.0952, 886, 0, 1, 0, 0, 886, 0, 0], "semantic": {"name": "pytesser", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pytesser import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:ImportFrom_L4_C0", "label": "from urllib import urlretrieve", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0357, 0, 0.66, 0.1429, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["urlretrieve"], "rhs_call_name": "", "annotation": ""}, "snippet": "from urllib import urlretrieve"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:Import_L5_C0", "label": "sys import sys", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1786, 0.0357, 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_1405:Assign_L8_C0", "label": "im = open()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.2857, 0.0357, 0, 0.66, 0.2381, 940, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "im", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "im = Image.open(sys.argv[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:Assign_L9_C0", "label": "nx, ny =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.3214, 0.0357, 0, 0.66, 0.2857, 892, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "nx, ny", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "nx, ny = im.size"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:Assign_L10_C0", "label": "im2 = resize()", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.3571, 0.0357, 0, 0.66, 0.3333, 912, 3, 2, 0, 0, 834, 10, 3], "semantic": {"name": "im2", "arg_names": [], "import_names": [], "rhs_call_name": "resize", "annotation": ""}, "snippet": "im2 = im.resize((int(nx*5), int(ny*5)), Image.BICUBIC)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:Expr_L11_C0", "label": "save()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 0.3929, 0.0357, 0, 0.66, 0.381, 928, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": "im2.save(\"temp2.png\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:Assign_L12_C0", "label": "enh = Contrast()", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.4286, 0.0357, 0, 0.66, 0.4286, 297, 3, 1, 0, 0, 120, 10, 1], "semantic": {"name": "enh", "arg_names": [], "import_names": [], "rhs_call_name": "Contrast", "annotation": ""}, "snippet": "enh = ImageEnhance.Contrast(im)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:Expr_L13_C0", "label": "show()", "type": "expression", "loc": [13, 13], "level": 0, "parent": null, "vector": [8, 0, 0.4643, 0.0357, 0, 0.66, 0.4762, 497, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "show", "arg_names": [], "import_names": [], "rhs_call_name": "show", "annotation": ""}, "snippet": "enh.enhance(1.3).show(\"30% more contrast\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:Assign_L15_C0", "label": "imgx = open()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.5357, 0.0357, 0, 0.66, 0.5238, 993, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "imgx", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "imgx = Image.open('temp2.png')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:Assign_L16_C0", "label": "imgx = convert()", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.5714, 0.0357, 0, 0.66, 0.5714, 993, 3, 1, 0, 0, 438, 10, 1], "semantic": {"name": "imgx", "arg_names": [], "import_names": [], "rhs_call_name": "convert", "annotation": ""}, "snippet": "imgx = imgx.convert(\"RGBA\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:Assign_L17_C0", "label": "pix = load()", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.6071, 0.0357, 0, 0.66, 0.619, 969, 3, 0, 0, 0, 37, 10, 1], "semantic": {"name": "pix", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": "pix = imgx.load()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:For_L18_C0", "label": "for y", "type": "for", "loc": [18, 21], "level": 0, "parent": null, "vector": [6, 0, 0.6964, 0.1429, 0, 0.66, 0.6667, 304, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for y in xrange(imgx.size[1]):\n for x in xrange(imgx.size[0]):\n if pix[x, y] != (0, 0, 0, 255):\n pix[x, y] = (255, 255, 255, 255)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:For_L19_C4", "label": "for x", "type": "for", "loc": [19, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1405:For_L18_C0", "vector": [6, 1, 0.7143, 0.1071, 1, 0.01, 0.0, 190, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in xrange(imgx.size[0]):\n if pix[x, y] != (0, 0, 0, 255):\n pix[x, y] = (255, 255, 255, 255)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:If_L20_C8", "label": "if", "type": "if", "loc": [20, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1405:For_L19_C4", "vector": [4, 2, 0.7321, 0.0714, 2, 0.82, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pix[x, y] != (0, 0, 0, 255):\n pix[x, y] = (255, 255, 255, 255)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:Assign_L21_C12", "label": "assign", "type": "assigned_variable", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1405:If_L20_C8", "vector": [14, 3, 0.75, 0.0357, 3, 0.39, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pix[x, y] = (255, 255, 255, 255)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:Expr_L22_C0", "label": "save()", "type": "expression", "loc": [22, 22], "level": 0, "parent": null, "vector": [8, 0, 0.7857, 0.0357, 0, 0.66, 0.7143, 928, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": "imgx.save(\"bw.gif\", \"GIF\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:Assign_L23_C0", "label": "original = open()", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.8214, 0.0357, 0, 0.66, 0.7619, 830, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "original", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "original = Image.open('bw.gif')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:Assign_L24_C0", "label": "bg = resize()", "type": "assigned_variable", "loc": [24, 24], "level": 0, "parent": null, "vector": [14, 0, 0.8571, 0.0357, 0, 0.66, 0.8095, 942, 3, 2, 0, 0, 834, 10, 1], "semantic": {"name": "bg", "arg_names": [], "import_names": [], "rhs_call_name": "resize", "annotation": ""}, "snippet": "bg = original.resize((116, 56), Image.NEAREST)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:Assign_L25_C0", "label": "ext =", "type": "assigned_variable", "loc": [25, 25], "level": 0, "parent": null, "vector": [14, 0, 0.8929, 0.0357, 0, 0.66, 0.8571, 916, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ext", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ext = \".tif\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:Expr_L26_C0", "label": "save()", "type": "expression", "loc": [26, 26], "level": 0, "parent": null, "vector": [8, 0, 0.9286, 0.0357, 0, 0.66, 0.9048, 928, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": "bg.save(\"input-NEAREST\" + ext)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:Assign_L27_C0", "label": "image = open()", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.9643, 0.0357, 0, 0.66, 0.9524, 505, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "image", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "image = Image.open('input-NEAREST.tif')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1405:Expr_L28_C0", "label": "print()", "type": "expression", "loc": [28, 28], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0357, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(image_to_string(image))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1405:For_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1405:For_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1405:For_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1405:If_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1405:If_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1405:Assign_L21_C12"}] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.